コード例 #1
0
 public function actionEdit()
 {
     $data = array();
     $id = urlGETParams('id', VARIABLE_NUMBER);
     $query = "SELECT * FROM tbl_category WHERE id = " . $id;
     $row = $this->db->createCommand($query)->queryRow();
     if (empty($row)) {
         $this->redirect($this->createUrl('index'));
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         //`parent_id`, `name`, `alias`, `meta_keywords`, `meta_description`, `meta_title`, `status`
         $params = array('parent_id' => formPostParams('parent_id', VARIABLE_NUMBER), 'name' => formPostParams('name'), 'alias' => change_url_seo(formPostParams('name')), 'meta_keywords' => formPostParams('meta_keywords'), 'meta_description' => formPostParams('meta_description'), 'meta_title' => formPostParams('meta_title'), 'status' => formPostParams('status', VARIABLE_NUMBER), 'is_feature' => formPostParams('is_feature', VARIABLE_NUMBER), 'weight' => formPostParams('weight', VARIABLE_NUMBER), 'cnet_url' => formPostParams('cnet_url'), 'techcrunch_url' => formPostParams('techcrunch_url'), 'wpcentral_url' => formPostParams('wpcentral_url'), 'android_center_url' => formPostParams('android_center_url'));
         yii_update_row($this->_table, $params, 'id = ' . $id);
         createMessage('Sửa danh mục thành công');
         $this->redirect($this->createUrl('index'));
     }
     $query = "SELECT id, name FROM tbl_category WHERE parent_id = 0";
     $result = $this->db->createCommand($query)->queryAll();
     foreach ($result as $item) {
         $data['category'][$item['id']] = $item['name'];
     }
     $data['row'] = $row;
     $this->render('add', array('data' => $data));
 }
コード例 #2
0
ファイル: ReviewController.php プロジェクト: haanhman/techz24
 public function actionApprove()
 {
     $id = urlGETParams('id', VARIABLE_NUMBER);
     $query = "SELECT * FROM tbl_archive WHERE id = " . $id;
     $row = $this->db_crawler->createCommand($query)->queryRow();
     if (!empty($row['tags'])) {
         $tags = json_decode($row['tags'], true);
         trim_array($tags);
         $tags = $this->createTags($tags);
     }
     //`tags`, `meta_keywords`, `meta_description`, `gallery`, `source_id`, `source_url`, `status`
     $values = array('cate_id' => $row['cate_id'], 'title' => $row['title'], 'alias' => $this->checkAlias(change_url_seo($row['title'])), 'thumbnail' => $row['thumbnail'], 'short_text' => $row['short_text'], 'content' => $row['content'], 'gallery' => $row['gallery'], 'meta_keywords' => $row['meta_keywords'], 'meta_description' => $row['meta_description'], 'source_id' => $row['source_id'], 'source_url' => $row['source_url'], 'have_video' => $row['have_video'], 'status' => 1, 'tags' => $tags, 'created' => time());
     yii_insert_row('archive', $values);
     createMessage('Approve noi dung: ' . $row['title'] . ' thành công');
     $query = "DELETE FROM tbl_archive WHERE id = " . $id;
     $this->db_crawler->createCommand($query)->execute();
     $this->redirect($this->createUrl('review/index', array('source' => $row['source_id'])));
 }
コード例 #3
0
 public function actionApprove()
 {
     $id = urlGETParams('id', VARIABLE_NUMBER);
     $query = "SELECT * FROM tbl_youtube WHERE id = " . $id;
     $row = $this->db_crawler->createCommand($query)->queryRow();
     if (!empty($row['tags'])) {
         $tags = json_decode($row['tags'], true);
         trim_array($tags);
         $tags = $this->createTags($tags);
     }
     unset($row['id']);
     unset($row['is_approve']);
     $row['alias'] = $this->checkAlias(change_url_seo($row['title']));
     $row['tags'] = $tags;
     $row['viewer'] = rand(123, 5000);
     $row['is_feature'] = intval($_GET['is_feature']);
     $publishedAt = trim($row['publishedAt'], '"');
     $row['created'] = strtotime($publishedAt);
     yii_insert_row('youtube', $row);
     createMessage('Approve video: ' . $row['title'] . ' thành công');
     $query = "UPDATE tbl_youtube SET is_approve = 1 WHERE id = " . $id;
     $this->db_crawler->createCommand($query)->execute();
     $this->redirect($this->createUrl('reviewyt/index'));
 }