public function get($fields, $select_set = FALSE)
 {
     if (!empty($fields['start_date'])) {
         $this->db->where("LEFT(start_date, " . strlen($fields['start_date']) . ") = '" . $fields['start_date'] . "'");
         unset($fields['start_date']);
     }
     CI()->load->model('file_model');
     return parent::get($fields, $select_set);
 }
예제 #2
0
 public function get($fields, $select_set = false)
 {
     if (!empty($fields['template_id']) && strpos($fields['template_id'], ',')) {
         // Selecting more then one item
         $id = explode(',', $fields['template_id']);
         $fields['template_id'] = array_unique(array_map("trim", $id));
     }
     // Do not get deleted items
     if ($this->table == 'page') {
         $this->param('WHERE', array($this->table . '.status <', 90));
     }
     return parent::get($fields, $select_set);
 }
예제 #3
0
 public function get($fields = null, $relations = false)
 {
     $result = parent::get($fields, $relations);
     $result_updated = array();
     // Make module specific updates to result array
     foreach ($result as $row) {
         // options: Create array from JSON string
         if (!empty($row['template_options'])) {
             $row['template_options'] = json_decode($row['template_options'], TRUE);
         }
         $result_updated[] = $row;
     }
     return $result_updated;
 }
예제 #4
0
 public function get($fields = array(), $return = false)
 {
     $item = parent::get($fields);
     $item_updated = array();
     if (count($item)) {
         // Make model specific updates to result array
         for ($i = 0; $i < count($item); $i++) {
             $row = $item[$i];
             if (empty($params['SELECT_SET']) || $params['SELECT_SET'] != 'basic') {
                 $row['sort_name'] = strtolower($row['title']);
                 $row['date'] = date('m-d-Y H:i', strtotime($row[$this->date_field['update']]));
                 $row['timestamp'] = date('U', strtotime($row[$this->date_field['update']]));
                 // Only perform the following if this is a file
                 if (!empty($row['type']) && $row['type'] == 'file') {
                     $var_length = (int) $this->FILE_CONF['file_dir_depth'] * 3;
                     $path_array = str_split(str_pad($row[$this->id_field], $var_length, '0', STR_PAD_LEFT), 3);
                     $upload_path = implode('/', $path_array);
                     /*
                     // To get the file's directory path. Don't need but lets keep around.		
                     unset($path_array[count($path_array)-1]);
                     $dir_path					= implode('/', $path_array);
                     $row['server_dir'] 			= DOCROOT . $this->FILE_CONF['file_location'] . $dir_path;
                     */
                     $base_view_path = $row[$this->id_field] . ($this->FILE_CONF['force_name_in_uri'] ? '/' . $row['file_name'] : '') . $row['ext'];
                     // Add file paths
                     //							$row['real_path'] 			= DOCROOT . zonepath($this->FILE_CONF['file_directory'] . '/' . $upload_path . $row['ext'], 'local');
                     $row['base_path'] = DOCROOT . zonepath($this->FILE_CONF['file_directory'] . '/' . $upload_path, 'local');
                     $row['server_path'] = $row['base_path'] . $row['ext'];
                     $row['view_path'] = reduce_multiples($this->FILE_CONF['file_website_location'] . $base_view_path, '/');
                     $row['manage_path'] = reduce_multiples(SITEPATH . $this->zone . CI()->SITE_CONF['file_uri_trigger'] . '/' . $base_view_path, '/');
                     // Add file size
                     $row['file_size'] = file_exists($row['server_path']) ? filesize($row['server_path']) : 0;
                     $row['file_size_display'] = file_exists($row['server_path']) ? $this->formatFileSize(filesize($row['server_path'])) : 0;
                 }
             }
             $item_updated[] = $row;
         }
         if (count($item_updated) > 1 && !empty($item_updated[0]['sort_name'])) {
             // Sort array
             $sort_array = array();
             foreach ($item_updated as $row) {
                 $sort_array[] = $row['sort_name'];
             }
             array_multisort($sort_array, SORT_ASC, $item_updated);
         }
     }
     return $item_updated;
 }
예제 #5
0
 public function get($fields = array())
 {
     $item = parent::get($fields);
     $item_updated = array();
     if (count($item)) {
         // Make model specific updates to result array
         for ($i = 0; $i < count($item); $i++) {
             $row = $item[$i];
             if (!empty($row['options']['multi']) && $row['options']['multi'] == 'yes') {
                 // Make sure its a json string
                 if (substr($row['value'], 0, 1) == '[' && substr($row['value'], -1) == ']') {
                     $row['value'] = json_decode($row['value'], true);
                 }
             }
             $item_updated[] = $row;
         }
     }
     return $item_updated;
 }
예제 #6
0
 public function get($fields, $select_set = FALSE)
 {
     if (!empty($fields['params']) && is_array($fields['params'])) {
         $fields['params'] = $this->_formatParams($fields['params']);
     }
     $this->db->where('expire_date > ', 'NOW()', FALSE);
     return parent::get($fields, $select_set);
 }
예제 #7
0
 public function get($fields, $select_set = false)
 {
     $return = parent::get($fields, $select_set);
     return $return;
 }
예제 #8
0
 public function get($fields, $select_set = false)
 {
     // Selecting more then one item
     if (!empty($fields[$this->id_field]) && is_array($fields[$this->id_field])) {
         $fields[$this->id_field] = array_unique(array_map("trim", $fields[$this->id_field]));
     } else {
         if (!empty($fields[$this->id_field]) && strpos($fields[$this->id_field], ',')) {
             $fields[$this->id_field] = explode(',', $fields[$this->id_field]);
             $fields[$this->id_field] = array_unique(array_map("trim", $fields[$this->id_field]));
         }
     }
     if (!empty($fields['template_id']) && strpos($fields['template_id'], ',')) {
         // Selecting more then one item
         $fields['template_id'] = explode(',', $fields['template_id']);
         $fields['template_id'] = array_unique(array_map("trim", $fields['template_id']));
     }
     if (in_array('status', $this->db_fields)) {
         // Do not get deleted items
         $this->param('WHERE', array($this->table . '.status <', 90));
     }
     return parent::get($fields, $select_set);
 }
예제 #9
0
 public function get($fields = null, $select_set = false)
 {
     // Always set the select_set so we can specify which fields from auto_join'd table to fetch
     $this->selectSet('basic');
     return parent::get($fields, $select_set);
 }