Esempio n. 1
0
 public function getFeedItems()
 {
     require_once BASE . 'external/feedcreator.class.php';
     // get all the feeds available to this expRss object
     $feeds = $this->getFeeds();
     $items = array();
     // loop over and build out a master list of rss items
     foreach ($feeds as $feed) {
         $controllername = expModules::getControllerClassname($feed->module);
         $controller = new $controllername($feed->src);
         $controller->loc = makeLocation($feed->module, $feed->src);
         $items = array_merge($items, $controller->getRSSContent());
     }
     return $items;
 }
Esempio n. 2
0
 /**
  * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content
  *
  * @return string
  */
 function aggregateWhereClause()
 {
     $sql = '';
     if (!$this->hasSources() && empty($this->config['add_source'])) {
         return $sql;
     }
     if (!empty($this->config['aggregate'])) {
         $sql .= '(';
     }
     $sql .= "location_data ='" . serialize($this->loc) . "'";
     if (!empty($this->config['aggregate'])) {
         foreach ($this->config['aggregate'] as $src) {
             $loc = makeLocation($this->baseclassname, $src);
             $sql .= " OR location_data ='" . serialize($loc) . "'";
         }
         $sql .= ')';
     }
     return $sql;
 }
Esempio n. 3
0
 /**
  * Adds table fields as class properties to current "record" class.
  *
  * Loads Table schema data and creates new class properties based
  * upon the fields in given table.
  *
  * Additionally, if a record ID is given, that record is pulled and
  * field values are also populated into class properties.
  *
  * @name build
  *
  * @category db_record
  * @uses [db_type]::getDataDefinition() Builds  a data definition from existing table.
  * @requires $db
  *
  * @access protected
  * @final
  * @PHPUnit Not Defined
  *
  * @global object $db
  * @param mixed $params array or Object for table selection
  *
  * @return none
  * @throws none
  *
  */
 public function build($params = array())
 {
     global $db;
     // safeguard against bad data...we can only take objects and arrays here
     if (!is_array($params) && !is_object($params)) {
         $params = array();
     }
     // get the table definition and make sure all the params being passed in belong in this table
     $table = $db->getDataDefinition($this->tablename);
     //check for location_data
     if (is_array($params) && (!empty($params['module']) && !empty($params['src']))) {
         $params['location_data'] = serialize(makeLocation($params['module'], $params['src']));
     } elseif (is_object($params) && (!empty($params->module) && !empty($params->src))) {
         $params->location_data = serialize(makeLocation($params->module, $params->src));
     }
     // Build Class properties based off table fields
     foreach ($table as $col => $colDef) {
         // check if the DB column has a corresponding value in the params array
         // if not, we check to see if the column is boolean...if so we set it to false
         // if not, then we check to see if we had a previous value in this particular
         // record.  if so we reset it to itself so we don't lose the existing value.
         // this is good for when the developer is trying to update just a field or two
         // in an existing record.
         if (array_key_exists($col, $params)) {
             $value = is_array($params) ? $params[$col] : $params->{$col};
             if ($colDef[0] == DB_DEF_INTEGER || $colDef[0] == DB_DEF_ID) {
                 $this->{$col} = preg_replace("/[^0-9-]/", "", $value);
             } elseif ($colDef[0] == DB_DEF_DECIMAL) {
                 $this->{$col} = preg_replace("/[^0-9.-]/", "", $value);
             } else {
                 $this->{$col} = $value;
             }
         } elseif ($colDef[0] == DB_DEF_BOOLEAN) {
             $this->{$col} = empty($this->{$col}) ? 0 : $this->{$col};
         } elseif ($colDef[0] == DB_DEF_TIMESTAMP) {
             $datename = $col . 'date';
             if (is_array($params) && isset($params[$datename])) {
                 $this->{$col} = yuidatetimecontrol::parseData($col, $params);
             } elseif (is_object($params) && isset($params->{$datename})) {
                 $this->{$col} = yuidatetimecontrol::parseData($col, object2Array($params));
             } else {
                 $this->{$col} = !empty($this->{$col}) ? $this->{$col} : 0;
             }
         } else {
             $this->{$col} = !empty($this->{$col}) ? $this->{$col} : null;
         }
         //if (isset($this->col)) {
         $this->{$col} = stripslashes($this->{$col});
         //}
     }
 }