[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/alfresco/Service/ -> BaseObject.php (source)

   1  <?php
   2  /*

   3   * Copyright (C) 2005-2010 Alfresco Software Limited.

   4   *

   5   * This file is part of Alfresco

   6   *

   7   * Alfresco is free software: you can redistribute it and/or modify

   8   * it under the terms of the GNU Lesser General Public License as published by

   9   * the Free Software Foundation, either version 3 of the License, or

  10   * (at your option) any later version.

  11   *

  12   * Alfresco is distributed in the hope that it will be useful,

  13   * but WITHOUT ANY WARRANTY; without even the implied warranty of

  14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  15   * GNU Lesser General Public License for more details.

  16   *

  17   * You should have received a copy of the GNU Lesser General Public License

  18   * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.

  19   */
  20  
  21  class BaseObject
  22  {
  23  	public function __get($name)
  24      {    
  25          $methodName = $name;
  26          $methodName[0] = strtoupper($methodName[0]);
  27          $methodName = 'get' . $methodName;
  28          
  29          if (method_exists($this, $methodName) == true)
  30          {
  31              return $this->$methodName();            
  32          }
  33      }
  34      
  35  	public function __set($name, $value)
  36      {
  37          $methodName = $name;
  38          $methodName[0] = strtoupper($methodName[0]);
  39          $methodName = 'set' . $methodName;
  40          
  41          if (method_exists($this, $methodName) == true)
  42          {
  43              return $this->$methodName($value);
  44          }    
  45      }
  46      
  47  	protected function resultSetToNodes($session, $store, $resultSet)
  48      {
  49          $return = array();        
  50          if (isset($resultSet->rows) == true)
  51          {
  52              if (is_array($resultSet->rows) == true)
  53              {        
  54                  foreach($resultSet->rows as $row)
  55                  {
  56                      $id = $row->node->id;
  57                      $return[] = $session->getNode($store, $id);                
  58                  }
  59              }
  60              else
  61              {
  62                  $id = $resultSet->rows->node->id;
  63                  $return[] = $session->getNode($store, $id);
  64              }
  65          }
  66          
  67          return $return;
  68      }
  69      
  70  	protected function resultSetToMap($resultSet)
  71      {
  72          $return = array();    
  73          if (isset($resultSet->rows) == true)
  74          {        
  75              if (is_array($resultSet->rows) == true)
  76              {
  77                  foreach($resultSet->rows as $row)
  78                  {
  79                      $return[] = $this->columnsToMap($row->columns);                
  80                  }
  81              }
  82              else
  83              {
  84                  $return[] = $this->columnsToMap($resultSet->rows->columns);
  85              }
  86  
  87          }
  88          
  89          return $return;    
  90      }
  91      
  92  	private function columnsToMap($columns)
  93      {
  94          $return = array();        
  95        
  96          foreach ($columns as $column)
  97          {
  98              $return[$column->name] = $column->value;
  99          }
 100          
 101          return $return;    
 102      }
 103      
 104  	protected function remove_array_value($value, &$array)
 105      {
 106          if ($array != null)
 107          {
 108              if (in_array($value, $array) == true)
 109              {
 110                  foreach ($array as $index=>$value2)
 111                  {
 112                      if ($value == $value2)
 113                      {
 114                          unset($array[$index]);
 115                      }
 116                  }
 117              }
 118          }
 119      } 
 120      
 121  	protected function isContentData($value)
 122      {        
 123          $index = strpos($value, "contentUrl=");
 124          if ($index === false)
 125          {
 126              return false;
 127          }    
 128          else
 129          {    
 130              if ($index == 0)
 131              {    
 132                  return true;
 133              }
 134              else
 135              {
 136                  return false;
 137              }
 138          }
 139      }
 140  }
 141  ?>


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1