public function actionDisplay() { $id = Request::getVar('id', null); $alias = Request::getVar('alias', null); $model = Video::getInstance(); if ($id == null or $id == "") { if ($alias != null and $alias != "") { $obj_item = $model->getItemByAlias($alias); } else { header("Location: /"); } } else { $obj_item = $model->getItem($id); } $items = $model->getItems($obj_item['catID'], true, 4); $items2 = $model->getItems($obj_item['catID'], false, 9); $obj_category = $model->getCategory($obj_item['catID']); $data['item'] = $obj_item; $data['items'] = $items; $data['items2'] = $items2; $data['category'] = $obj_category; $page_title = $obj_item['title']; $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title; $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_keyword); setSysConfig("seopage.description", $page_description); Request::setVar('alias', $obj_category['alias']); $this->render('default', $data); }
public function actionEdit() { $cid = Request::getVar('cid', ""); setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink("videos", array('layout' => 'save')), "save"); $this->addIconToolbar("Apply", Router::buildLink("videos", array('layout' => 'apply')), "apply"); $this->addBarTitle("Video <small>[Edit]</small>", "user"); $this->addIconToolbar("Close", Router::buildLink("videos", array('layout' => 'cancel')), "cancel"); $this->pageTitle = "Edit video"; $model = Video::getInstance(); $item = $model->getItem($cid); global $user; if (!($bool = $user->modifyChecking($item->created_by))) { $obj_users = YiiUser::getInstance(); $item_user = $obj_users->getUser($item->created_by); YiiMessage::raseNotice("Your account not have permission to edit resource of: {$item_user->username}"); $this->redirect(Router::buildLink("article")); return false; } $list = $model->getListEdit($item); $this->render('edit', array("item" => $item, "list" => $list)); }
public function actionBlog() { $model = Video::getInstance(); $catAlias = Request::getVar('alias', null); $catID = Request::getVar("id"); $currentPage = Request::getVar('page', 1); $limit = 12; $data['alias'] = $catAlias; $obj_category = $model->getCategory($catID, $catAlias); if ($obj_category == false) { $this->redirect(Router::buildLink('videos')); } if ($currentPage == 1) { $data['items'] = $model->getItems($obj_category['id'], true, 5); } $start = ($currentPage - 1) * $limit; $data['items2'] = $model->getItems($obj_category['id'], false, $limit, $start); if ($obj_category['total'] > $start + $limit) { $page = $currentPage + 1; } else { $page = $currentPage - 1; } $catAlias = $obj_category['alias']; $params = array("view" => "category", "id" => $obj_category['id'], "alias" => $obj_category['alias'], "page" => $page); $obj_category['pagemore'] = Router::buildLink('videos', $params); $page_title = $obj_category['title']; if ($currentPage > 1) { $page_title = $page_title . " trang {$currentPage}"; } $page_keyword = $obj_category['metakey'] != "" ? $obj_category['metakey'] : $page_title; $page_description = $obj_category['metadesc'] != "" ? $obj_category['metadesc'] : $page_title; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_keyword); setSysConfig("seopage.description", $page_description); $data['category'] = $obj_category; $this->render('blog', $data); }