Example #1
0
 public function getList()
 {
     $arrCriteria = array('a.admin LIKE ?' => '%' . $this->_filters['admin'] . '%', 'a.description LIKE ?' => '%' . $this->_filters['description'] . '%');
     if ($this->_filters['action'] != '0' && $this->_filters['action'] != '') {
         $arrCriteria['a.action = ?'] = $this->_filters['action'];
     }
     if ($this->_filters['tbl'] != '0' && $this->_filters['tbl'] != '') {
         $arrCriteria['a.tbl = ?'] = $this->_filters['tbl'];
     }
     //$arrCriteria['a.name IN (?)'] = array_keys($this->getDropdownName());
     $select = new Select('log');
     $select->addField('id_log');
     $select->addField('admin');
     $select->addField('tbl');
     $select->addField('inc_date');
     $select->addField('action');
     $select->addField('description');
     $select->where($arrCriteria);
     $select->order_by('a.inc_date DESC');
     $this->_paginator = new PaginatorAdmin($this->_itens_per_page, $this->_filters['pag']);
     $this->setPaginationSelect($select);
     $result = $this->_dao->select($select);
     foreach ($result as $i => $row) {
         $result[$i]['action'] = Arrays::$logAcao[$row['action']];
         $result[$i]['inc_date'] = DateFormat::filter_date($row['inc_date'], 'd/m/Y H:i:s');
         $entity = $this->_entities->getEntity($row['tbl']);
         $result[$i]['tbl'] = $entity->getSection();
     }
     return $result;
 }
Example #2
0
 public function getList()
 {
     $itens = $this->_entities->getTrashItens();
     if ($this->_filters['section'] != '' && $this->_filters['section'] != '0') {
         $itens = array($itens[$this->_filters['section']]);
     }
     $i = 0;
     foreach ($itens as $item) {
         $table_name = $item->getTbl();
         $id_field = $item->getId();
         $title_field = $item->getTitle();
         $section = $item->getSection();
         $select1 = new Select($table_name);
         $select1->addField($id_field, 'id');
         $select1->addField($title_field, 'title');
         $select1->addField('del_date');
         $select1->addSField('section', $section);
         $select1->addSField('entity_name', $table_name);
         $select1->where(array('is_del = 1' => null, $title_field . ' LIKE ?' => '%' . $this->_filters['title'] . '%'));
         if ($i == 0) {
             $select = $select1;
         } else {
             $select->union($select1);
         }
         $i++;
     }
     $select->order_by('del_date DESC');
     $this->_paginator = new PaginatorAdmin($this->_itens_per_page, $this->_filters['pag']);
     $this->setPaginationSelect($select);
     $result = $this->_dao->select($select);
     foreach ($result as $i => $row) {
         $result[$i]['del_date'] = DateFormat::filter_date($row['del_date'], 'd/m/Y H:i');
     }
     return $result;
 }
Example #3
0
 public function getTweets()
 {
     $tweets = $this->_model->getTweets();
     foreach ($tweets as $i => $row) {
         $tweets[$i]['date'] = DateFormat::filter_dateTimeExtensive($row['date']);
     }
     return $tweets;
 }
Example #4
0
 public function insertComplete($input)
 {
     if (function_exists('curl_file_create')) {
         $file = curl_file_create($input['file']);
     } else {
         $file = '@' . $input['file'];
     }
     $track = array('track[title]' => $input['title'], 'track[asset_data]' => $file, 'track[downloadable]' => true, 'track[streamable]' => true, 'track[description]' => trim(strip_tags($input['description'])), 'track[tag_list]' => $input['tag_list']);
     if (isset($input['date']) && DateFormat::validate($input['date'])) {
         $d = DateFormat::filter_date($input['date'], 'd');
         $m = DateFormat::filter_date($input['date'], 'm');
         $y = DateFormat::filter_date($input['date'], 'Y');
         $track['track[release_day]'] = $d;
         $track['track[release_month]'] = $m;
         $track['track[release_year]'] = $y;
     }
     if (isset($input['cover'])) {
         if (function_exists('curl_file_create')) {
             $cover = curl_file_create($input['cover']);
         } else {
             $cover = '@' . $input['cover'];
         }
         $track['track[artwork_data]'] = $cover;
     }
     try {
         $response_text = $this->_api->post('tracks', $track);
     } catch (\Soundcloud\Exception\InvalidHttpResponseCodeException $e) {
         $error = json_decode($e->getHttpBody());
         $msg = $error->errors[0]->error_message;
         throw new \Exception($msg);
     }
     $response_json = json_decode($response_text);
     if (json_last_error()) {
         throw new Exception('Não foi possível converter pra JSON: ' . $response_text);
     }
     $f = new TableFilter($this->_table, array('track_id' => $response_json->id, 'track_permalink' => $response_json->permalink_url));
     $f->newId()->filter('id_soundcloud');
     $f->string()->filter('track_id');
     $f->string()->filter('track_permalink');
     $this->_dao->insert($this->_table);
     return $this->_table->id_soundcloud;
 }