コード例 #1
0
 /**
 * deleteCatalog method removes a record from the video_catalogs table
 *
 * @param array $options
 */
 function deleteCatalog($options = array())
 {
     // required values
     if (!_required(array('vcid'), $options)) {
         return false;
     }
     if ((int) $options['vcid'] < 10) {
         return false;
     }
     $this->db->where('vcid', $options['vcid']);
     $this->db->delete('video_catalogs');
 }
コード例 #2
0
 /**
 * deleteUser method removes a record from the users table
 *
 * @param array $options
 */
 function deleteUser($options = array())
 {
     // required values
     if (!_required(array('uid'), $options)) {
         return false;
     }
     $this->db->where('uid', $options['uid']);
     $this->db->delete('users');
 }
コード例 #3
0
 /**
 * deleteEbook method removes a record from the ebooks table
 *
 * @param array $options
 */
 function deleteEbook($options = array())
 {
     // required values
     if (!_required(array('eid'), $options)) {
         return false;
     }
     $this->db->where('eid', $options['eid']);
     $this->db->delete('ebooks');
 }
コード例 #4
0
 /**
 * delete method removes a record from the suggess_video table
 *
 * @param array $options
 */
 function delete($options = array())
 {
     // required values
     if (!_required(array('svid'), $options)) {
         return false;
     }
     $this->db->where('svid', $options['svid']);
     $this->db->delete('suggess_video');
 }
コード例 #5
0
 /**
 * delete method removes a record from the banner table
 *
 * @param array $options
 */
 function delete($options = array())
 {
     if (!_required(array('bid'), $options)) {
         return false;
     }
     $this->db->where('bid', $options['bid']);
     $this->db->delete('banner');
 }
コード例 #6
0
 /**
 * stats method returns an array of video_statics record objects
 *
 * Option: Values
 * --------------
 * date_from				begin of creation date period search
 * date_to				end of creation date period search
 * limit                limits the number of returned records
 * offset                how many records to bypass before returning a record (limit required)
 * sortBy                determines which column the sort takes place
 * sortDirection        (asc, desc) sort ascending or descending (sortBy required)
 *
 * Returns (array of objects)
 * --------------------------
 * vsid
 * video_id
 * day_clicks
 * update_time
 *
 * @param array $options
 * @return array result()
 */
 function stats($options = array())
 {
     if (!_required(array('date_from', 'date_to'), $options)) {
         return false;
     }
     $options = _default(array('sortDirection' => 'asc'), $options);
     $date_from = strtotime($options['date_from']);
     $this->db->where('date >=', date('Y-m-d H:i:s', $date_from));
     $date_to = strtotime($options['date_to']);
     $this->db->where('date <=', date('Y-m-d H:i:s', $date_to + 86399));
     $this->db->or_where('vid !=', 0);
     $this->db->group_by('vid');
     $this->db->select_sum('day_clicks');
     $this->db->select('vid, title, vlength, videocatalog_id, clicks, description, author, create_time');
     $this->db->from('videos');
     $this->db->join('video_statistics', 'videos.vid = video_statistics.video_id', 'left');
     // If limit / offset are declared (usually for pagination) then we need to take them into account
     if (isset($options['limit']) && isset($options['offset'])) {
         $this->db->limit($options['limit'], $options['offset']);
     } else {
         if (isset($options['limit'])) {
             $this->db->limit($options['limit']);
         }
     }
     // sort
     if (isset($options['sortBy'])) {
         $this->db->order_by($options['sortBy'], $options['sortDirection']);
     }
     $query = $this->db->get();
     return $query->result();
 }