コード例 #1
0
 /**
  * @test
  */
 public function search()
 {
     // recherche par nom
     $model = new NewsCategory('search');
     $model->unsetAttributes();
     $model->name = "1";
     $data = $model->search()->data;
     $this->assertEquals(1, count($data));
     $model->unsetAttributes();
     $model->name = 'at';
     $data = $model->search()->data;
     $this->assertEquals(3, count($data));
 }
コード例 #2
0
 /**
  * getListItems - Phương thức dùng để lấy dữ liệu
  */
 public function getListItems($category_id = null)
 {
     Yii::import('application.modules.news.models.NewsItem');
     $model = new NewsItem('search');
     $model->unsetAttributes();
     $criteria = new CDbCriteria();
     $criteria->order = 'created DESC';
     if ($category_id) {
         Yii::import('application.modules.news.models.NewsCategory');
         $categories = NewsCategory::model()->findByPk($category_id);
         if (!$categories) {
             return null;
         }
         $this->__category = $categories;
         $descendants = $categories->descendants()->findAll('is_active = 1');
         $arrCat = array($category_id);
         foreach ($descendants as $cat) {
             $arrCat[] = $cat->id;
         }
         $criteria->with = array('categoryitem');
         $criteria->together = true;
         foreach ($arrCat as $cat) {
             $criteria->compare('categoryitem.category_id', $cat, false, 'OR');
         }
     }
     $criteria->compare('status', 1);
     $search = new CActiveDataProvider($model, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->getModule('news')->entriesLastestShow)));
     $data = $search->getData();
     return $data;
 }
コード例 #3
0
ファイル: NewsCategoryTest.php プロジェクト: kleitz/bzion
 public function testCustomNewsCategoryQueryBuilder()
 {
     $qb = $this->newsCategory->getQueryBuilder();
     $this->assertInstanceOf('QueryBuilder', $qb);
     $results = $qb->where("status")->equals("enabled")->getModels();
     $this->assertArrayLengthEquals($results, 2);
 }
コード例 #4
0
 public function getCategory()
 {
     $Params = $this->getURLParams();
     if (is_numeric($Params['ID']) && ($Category = NewsCategory::get()->byID((int) $Params['ID']))) {
         return $Category;
     }
 }
コード例 #5
0
 public function getCategory()
 {
     $categoryID = $this->request->getVar('category');
     if (!is_null($categoryID)) {
         return NewsCategory::get_by_id('NewsCategory', $categoryID);
     }
 }
コード例 #6
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return NewsCategory the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = NewsCategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #7
0
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'name, alt_name, title';
     $criteria->order = 'name';
     $model = NewsCategory::model()->findAll($criteria);
     $this->render('widgetCategories', array('model' => $model));
 }
コード例 #8
0
 public function __construct($modelClass, $newsAdmin = null, $fields = null, $filters = null)
 {
     $fields = new FieldList(TextField::create('Title'), TextField::create('URLSegment'), DropdownField::create('ParentID', 'Parent page')->setSource(NewsIndex::get()->map('ID', 'Title')->toArray())->setEmptyString('Select'), HeaderField::create('DatesHeader', 'Dates')->setHeadingLevel(3), DateField::create('StartDate')->setTitle(null)->setAttribute('placeholder', 'Start Date'), DateField::create('EndDate')->setTitle(null)->setAttribute('placeholder', 'End Date'), CheckboxSetField::create('Types')->setSource(NewsSearchContext::GetNewsTypes($newsAdmin))->setValue(isset($_REQUEST['q']) && isset($_REQUEST['q']['Types']) ? $_REQUEST['q']['Types'] : null), TextField::create('Tags'), TextField::create('Summary'), TextField::create('Content'), TextField::create('Author'), CheckboxSetField::create('Categories')->setSource(NewsCategory::get()->map('ID', 'Title')->toArray())->setValue(isset($_REQUEST['q']) && isset($_REQUEST['q']['Categories']) ? $_REQUEST['q']['Categories'] : null));
     $filters = array('Title' => new PartialMatchFilter('Title'), 'URLSegment' => new PartialMatchFilter('URLSegment'), 'ParentID' => new ExactMatchFilter('ParentID'), 'Tags' => new PartialMatchFilter('Tags'), 'Summary' => new PartialMatchFilter('Summary'), 'Content' => new PartialMatchFilter('Content'), 'Author' => new PartialMatchFilter('Author'), 'StartDate' => new GreaterThanOrEqualFilter('DateTime'), 'EndDate' => new LessThanOrEqualFilter('DateTime'));
     if ($newsAdmin) {
         $this->newsAdmin = $newsAdmin;
     }
     parent::__construct($modelClass, $fields, $filters);
 }
コード例 #9
0
ファイル: detail.php プロジェクト: hqd276/bigs
 function draw()
 {
     global $display;
     $id = intval(Url::get('id', 0));
     if (!empty($id)) {
         $item = News::get_item($id);
     }
     if (empty($item)) {
         Url::redirect_url('/tin-tuc.html');
         exit;
     }
     if (!empty($item)) {
         if (!empty($item['category_id'])) {
             $categories = NewsCategory::get_by_ids($item['category_id']);
         }
         if ($item['is_active'] == 0) {
             Url::redirect_url('/tin-tuc.html');
             exit;
         }
         if ($item['uid'] > 0) {
             $author = User::getUserById($item['uid']);
             // var_dump($author);die;
             if ($author['full_name'] == '') {
                 $item['author'] = $author['user_name'];
             } else {
                 $item['author'] = $author['full_name'];
             }
         }
         $item['view'] += 1;
         News::update_view(array('view' => $item['view']), 'id=' . $id);
     }
     $tags = News::render_tags($item['keywords']);
     $related_items = NewsCategory::get_top_news($item['category_id'], 4);
     if (count($related_items > 0)) {
         foreach ($related_items as $key => $value) {
             // $list_news[$key]['title'] = Util::split_char($value['title'],40,-1) . ' ...';
             if ($value['uid'] > 0) {
                 $author = User::getUserById($value['uid']);
                 // var_dump($author);die;
                 if ($author['full_name'] == '') {
                     $related_items[$key]['author'] = $author['user_name'];
                 } else {
                     $related_items[$key]['author'] = $author['full_name'];
                 }
             }
         }
     }
     $display->add('roots', NewsCategory::get_categories());
     $display->add('item', $item);
     $display->add('tags', $tags);
     $display->add('related_items', $related_items);
     $display->add("categories", $categories);
     $display->output("Detail");
 }
コード例 #10
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $dateTimeField = new DatetimeField('Date'), 'Content');
     $dateTimeField->getDateField()->setConfig('showcalendar', true);
     $categories = NewsCategory::get()->sort('Title ASC');
     if ($categories && $categories->exists()) {
         $fields->addFieldToTab('Root.Main', new DropdownField('CategoryID', 'Category', $categories->map()), 'Content');
     }
     $fields->addFieldToTab('Root.Main', new TextareaField('Abstract'), 'Content');
     return $fields;
 }
コード例 #11
0
 /**
  * getData - Phương thức dùng để lấy dữ liệu
  */
 public function getData()
 {
     $arrTrees = array();
     Yii::import('application.modules.news.models.NewsCategory');
     $treeRoot = NewsCategory::model()->roots()->find();
     if ($treeRoot) {
         $descendants = $treeRoot->descendants()->findAll('is_active = 1');
         $tree = $treeRoot->toArray($descendants);
         $arrTrees = $this->__getListChilds($tree);
     }
     return $arrTrees;
 }
コード例 #12
0
 public function getCMSFields()
 {
     $datefield = DateField::create('Date')->setTitle('Article Date');
     $datefield->setConfig('showcalendar', true);
     $datefield->setConfig('dateformat', 'MM/dd/YYYY');
     $imagefield = UploadField::create('Photo')->setTitle('Featured Photo');
     $imagefield->folderName = 'News';
     $imagefield->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $imagefield->getValidator()->setAllowedMaxFileSize('2097152');
     // 2 MB in bytes
     $categoriesMap = NewsCategory::get()->filter('NewsHolderID', $this->Parent()->ID)->sort('Title ASC')->map('ID', 'Title')->toArray();
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Main', array($datefield, TextField::create('Author')->setTitle('Author Name'), $imagefield, ListboxField::create('NewsCategories')->setTitle('Category')->setMultiple(true)->setSource($categoriesMap)), 'Content');
     return $fields;
 }
コード例 #13
0
ファイル: detail.php プロジェクト: hqd276/bigs
 function draw()
 {
     $this->beginForm(false, 'post', false, Url::build_current());
     $category_id = intval(Url::get('id', 0));
     $category = array();
     // Get Data
     if (!empty($category_id)) {
         $category = NewsCategory::get_category($category_id, true);
     }
     global $display;
     $display->add('category', $category);
     $display->add('error_message', $this->getErrorMessage('news/category/error'));
     $display->add('success_message', $this->getSuccessMessage('news/category/success'));
     $display->output('Edit');
     $this->endForm();
 }
コード例 #14
0
ファイル: NewsController.php プロジェクト: Cranky4/npfs
 /**
  * Список новостей
  */
 public function actionIndex($idCategory = null)
 {
     $criteria = new CDbCriteria();
     $criteria->scopes = array('last');
     $newsModule = $this->getModule();
     $category = null;
     $categories = array();
     //Если включено отображение категорий
     if ($newsModule->showCategories) {
         if ($idCategory !== null && ($category = $this->loadModelOr404('NewsCategory', $idCategory))) {
             $criteria->compare('t.id_news_category', $idCategory);
         }
         $categories = NewsCategory::model()->findAll(array('order' => 'seq'));
     }
     $count = News::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = $newsModule->itemsCountPerPage;
     $pages->applyLimit($criteria);
     $news = News::model()->findAll($criteria);
     $this->render('/index', array('news' => $news, 'pages' => $pages, 'category' => $category, 'categories' => $categories));
 }
コード例 #15
0
ファイル: detail.php プロジェクト: hqd276/bigs
 function draw()
 {
     global $display;
     $this->beginForm(true, 'post', false, Url::build_current());
     $item_id = intval(Url::get('id', 0));
     $cid = intval(Url::get('cid', 0));
     if (!empty($cid)) {
         $display->add('cid', $cid);
     }
     $item = array();
     // Get Data
     if ($item_id) {
         $item = News::get_item($item_id);
     }
     $display->add('item', $item);
     $display->add('categories', NewsCategory::get_categories());
     $display->add('error_message', $this->getErrorMessage('news/item/error'));
     $display->add('success_message', $this->getSuccessMessage('news/item/success'));
     $display->output('Detail');
     $this->endForm();
 }
コード例 #16
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if (!Config::inst()->get('NewsPost', 'pages_admin')) {
         $arrTypes = NewsPost::GetNewsTypes();
         if (count($arrTypes) > 1) {
             $arrDropDownSource = array();
             foreach ($arrTypes as $strType) {
                 $arrDropDownSource[$strType] = $strType;
             }
             $fields->addFieldToTab('Root.Main', DropdownField::create('ClassName')->setSource($arrDropDownSource)->setTitle('Type'), 'Content');
         }
     }
     $fields->addFieldsToTab('Root.Main', array(DropdownField::create('ParentID')->setSource(NewsIndex::get()->map()->toArray())->setTitle('Parent Page'), DatetimeField::create('DateTime'), TextField::create('Tags'), TextField::create('Author'), HtmlEditorField::create('Summary')->setRows(5)), 'Content');
     if ($this->ID) {
         $fields->addFieldToTab('Root.Main', CheckboxSetField::create('Categories')->setSource(NewsCategory::get()->map('ID', 'Title')->toArray()), 'Content');
         $fields->addFieldToTab('Root.RelatedArticles', GridField::create('RelatedArticles', 'Related Articles')->setList($this->RelatedArticles())->setConfig($relatedArticlesConfig = new GridFieldConfig_RelationEditor()));
     }
     $this->extend('updateNewsPostCMSFields', $fields);
     return $fields;
 }
コード例 #17
0
ファイル: sampleData.php プロジェクト: allejo/bzion
$conversation->sendMessage($kierra, "I had a page. No addon, plugin to windows it...");
$conversation->sendMessage($allejo, "so I'm the world  (which was amazing :)");
$event = new ConversationKickEvent($conversation, $lweak, $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_KICK);
$event = new ConversationKickEvent($conversation, $brad, $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_KICK);
$conversation->sendMessage($autoreport, "she also going to essential command and to https://github Releases?\"  \"No!\"  \"STOP! IT!\"  \"*pbbbttt*\"  \"That's interesting I want help");
$conversation->sendMessage($autoreport, "I wonder 600KB) screenshot here. but how much I know all I was doing to debug, visual studio");
$conversation->sendMessage($autoreport, "and night night!");
echo " done!";
echo "\nAdding bans...";
Ban::addBan($snake->getId(), $alezakos->getId(), "2014-09-15", "Snarke 12534 has been barned again", "Cuz you're snake", "256.512.104.1");
Ban::addBan($allejo->getId(), $tw1sted->getId(), "2014-05-17", "for using 'dope'", "dope", array("127.0.2.1", "128.0.3.2"));
Ban::addBan($tw1sted->getId(), $alezakos->getId(), "2014-06-12", "tw1sted banned for being too awesome");
Ban::addBan($alezakos->getId(), $tw1sted->getId(), "2014-11-01", "alezakos banned for breaking the build", "For breaking the build", array("256.512.124.1", "256.512.124.3"));
echo " done!";
echo "\nAdding pages...";
Page::addPage("Rules", "<p>This is a test page.</p>\n<p>Let's hope this works!</p>", $tw1sted->getId());
Page::addPage("Contact", "<p>If you find anything wrong, please stop by irc.freenode.net channel #sujevo and let a developer know.<br /><br />Thanks", $tw1sted->getId());
echo " done!";
echo "\nAdding news categories...";
$announcements = NewsCategory::addCategory("Announcements");
$administration = NewsCategory::addCategory("Administration");
$events = NewsCategory::addCategory("Events");
$newFeatures = NewsCategory::addCategory("New Features");
echo " done!";
echo "\nAdding news entries...";
News::addNews("Announcement", "Very important Announcement", $kierra->getId(), $newFeatures->getId());
News::addNews("Cats think we are bigger cats", "In order for your indess recognizes where this whole mistake has come, and why one accuses the pleasure and praise the pain, and I will open to you all and set apart, what those founders of the truth and, as builders of the happy life himself has said about it. No one, he says, despise, or hate, or flee the desire as such, but because great pain to follow, if you do not pursue pleasure rationally. Similarly, the pain was loved as such by no one or pursues or desires, but because occasionally circumstances occur that one means of toil and pain can procure him some great pleasure to look verschaften be. To stay here are a trivial, so none of us would ever undertakes laborious physical exercise, except to obtain some advantage from it. But who is probably the blame, which requires an appetite, has no annoying consequences, or one who avoids a pain, which shows no desire? In contrast, blames and you hate with the law, which can soften and seduced by the allurements of present pleasure, without seeing in his blind desire which pain and inconvenience wait his reason. Same debt meet Those who from weakness, i.e to escape the work and the pain, neglect their duties. A person can easily and quickly make the real difference, to a quiet time where the choice of the decision is completely free and nothing prevents them from doing what we like best, you have to grasp every pleasure and every pain avoided, but to times it hits in succession of duties or guilty of factual necessity that you reject the desire and complaints must not reject. Why then the way will make a selection so that it Achieve a greater rejection by a desire for it or by taking over some pains to spare larger.", $alezakos->getId());
echo " done!";
echo "\n\nThe database has been populated successfully.\n";
コード例 #18
0
ファイル: ApiHandler.php プロジェクト: textagroup/brafton-api
 /**
  * @return Category[]
  */
 public function getCategoryDefinitions()
 {
     return NewsCategory::getCategories($this->categoryUrl);
 }
コード例 #19
0
 /**
  * @return Category[]
  */
 public function getCategoryDefinitions()
 {
     JLog::add('load category definitions with.' . $this->categoryUrl, JLog::INFO, 'com_braftonarticles');
     return NewsCategory::getCategories($this->categoryUrl);
 }
コード例 #20
0
ファイル: NewsController.php プロジェクト: Puskice/PuskiceCMS
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function postUpdate($id)
 {
     if (Session::get('user_level') < Config::get('cms.editNews')) {
         return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning');
     }
     $rules = array('title' => 'Required', 'shortContent' => 'Required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to(_l(URL::action('NewsController@getEdit') . "/" . $id))->withErrors($validator)->withInput();
     } else {
         try {
             $news = News::findOrFail($id);
             $news->title = Input::get('title');
             if (!Input::get('permalink')) {
                 $news->permalink = slugify(Input::get('title'));
             } else {
                 $news->permalink = slugify(Input::get('permalink'));
             }
             if (Input::get('createdAt')) {
                 $news->created_at = date("Y-m-d H:i:s", strtotime(Input::get('createdAt')));
             } else {
                 $news->created_at = date("Y-m-d H:i:s", strtotime('now'));
             }
             $news->short_content = Input::get('shortContent', null, false);
             if (!Input::get('longContent')) {
                 $news->long_content = Input::get('shortContent', null, false);
             } else {
                 $news->long_content = Input::get('longContent', null, false);
             }
             $news->featured = Input::get('featured');
             $news->last_modified_by = Session::get('id');
             $news->published_by = Input::get('publishedBy');
             $news->featured_image = Input::get('featuredImage');
             $news->image_caption = Input::get('imageCaption');
             $news->post_type = 1;
             $news->published = Input::get('published');
             $news->save();
             $news->newsCategories()->delete();
             if (Input::get('categories')) {
                 foreach (Input::get('categories') as $catid) {
                     $newsCategory = new NewsCategory();
                     $newsCategory->news_id = $news->id;
                     $newsCategory->category_id = $catid;
                     $newsCategory->save();
                 }
             }
             return Redirect::to(_l(URL::action('NewsController@getEdit') . "/" . $id))->with('message', Lang::get('admin.newsUpdated'))->with('notif', 'success');
         } catch (Exception $e) {
             return Redirect::to(_l(URL::action('NewsController@getIndex')))->with('message', Lang::get('admin.noSuchNews'))->with('notif', 'danger');
         }
     }
 }
コード例 #21
0
ファイル: news.php プロジェクト: abdul-baten/hbcms
 public function action_news_edit($news_id = 0)
 {
     $this->template->title = __("Chỉnh sửa thông tin bài viết");
     $this->template->section_title = __("Chỉnh sửa thông tin bài viết");
     $data = array();
     $news = News::BLL()->find($news_id);
     if (!$news) {
         Message::error('Bài viết không tồn tại!');
         Request::instance()->redirect('admin/news/cat_index');
     }
     if (Request::$method == "POST") {
         $cat_id = intval($_POST['category_id']);
         if ($cat_id < 1) {
             Message::error('Mục tin cho bài viết không tồn tại!');
             Request::instance()->redirect('admin/news/cat_index');
         }
         $cat = NewsCategory::BLL()->find($cat_id);
         if (!$cat) {
             Message::error('Mục tin cho bài viết không tồn tại!');
             Request::instance()->redirect('admin/news/cat_index');
         }
         $active = isset($_POST['active']);
         $post = $news->validate_update($_POST);
         if ($post->check()) {
             //die($news->id);
             $post = $post->as_array();
             $news->title = $post['title'];
             $news->slug = $post['slug'];
             $news->summary = $post['summary'];
             $news->img_thumb = $post['img_thumb'];
             $news->content = $post['story_content'];
             $news->active = $active;
             $news->Category = $cat;
             $news->save();
             Message::success('Thay đổi thông tin bài viết thành công!');
             Request::instance()->redirect('admin/news/by_cat/' . $cat->id);
         } else {
             $data['errors'] = $post->errors('admin/news');
             $_POST = $post->as_array();
         }
     }
     //get category select list
     $categories = NewsCategory::BLL()->findAll()->toArray();
     $select_cat = array();
     foreach ($categories as $cat) {
         $select_cat[$cat['id']] = $cat['name'];
     }
     $data['select_cat'] = $select_cat;
     $data['news'] = $news->toArray();
     $this->template->content = View::factory('admin/news/news_edit', $data);
 }
コード例 #22
0
ファイル: News.php プロジェクト: blast007/bzion
 /**
  * Get the category of the news article
  * @return NewsCategory The category of the post
  */
 public function getCategory()
 {
     return NewsCategory::get($this->category);
 }
コード例 #23
0
 /** @return String **/
 public function getCategories()
 {
     if (empty($this->categories)) {
         $xh = $this->getFullNewsXML();
         $this->categories = NewsCategory::getCategories($xh->getHrefValue(CATEGORIES));
     }
     return $this->categories;
 }
コード例 #24
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  * @throws Exception
  */
 public function actionUpdate($id)
 {
     /** @var myWebUser $webUser */
     /** @noinspection PhpUndefinedFieldInspection */
     $webUser = Yii::app()->user;
     /** @var News $model */
     $model = News::model()->findByPk($id);
     $hasErrors = false;
     // Sauvegarde de l'objet News
     if (isset($_POST['News'])) {
         $model->attributes = $_POST['News'];
         if ($model->save()) {
             $webUser->setFlash('success', Yii::t('msg', 'Object saved'));
         } else {
             $webUser->setFlash('error', Yii::t('msg', 'There are errors. Please check the form'));
             $hasErrors = true;
         }
     }
     // Sauvegarde d'une des traductions
     if (isset($_POST['TranslatedNews'])) {
         $fields = array_shift($_POST['TranslatedNews']);
         /** @var $translation TranslatedNews */
         if (!($translation = TranslatedNews::model()->findByPk($fields['id']))) {
             throw new Exception(h::_("Traduction introuvable #" . $fields['id'], __FILE__, __LINE__, __METHOD__));
         }
         $oldTagsString = $translation->tagsString;
         $translation->attributes = $fields;
         if ($translation->save() && $this->saveTranslatedNewsTags($translation, $oldTagsString)) {
             $webUser->setFlash('success', Yii::t('msg', 'Object saved'));
         } else {
             $webUser->setFlash('error', Yii::t('msg', "There are errors in some sub-forms"));
             $hasErrors = true;
         }
         $translations = array();
         foreach ($model->translatedNews as $i => $it) {
             // Dans la liste des traduction de la news, on cherche celle qui est l'objet de la mise à jour
             // et on remplace le modèle chargé initialement par celui qui vient d'être validé,
             // (donc qui a une liste d'erreurs en cas de problèmes)
             if ($it->id == $translation->id) {
                 $translations[$i] = $translation;
             } else {
                 $translations[$i] = $it;
             }
         }
     }
     if (isset($_POST['backToList']) && !$hasErrors) {
         // On a cliqué le bouton 'revenir à la liste' et le formulaire a bien été traité
         $this->redirect(array('admin'));
     }
     /** @noinspection PhpUndefinedMethodInspection */
     $this->render('update', array('model' => $model, 'translations' => isset($translations) ? $translations : $model->translatedNews, 'categories' => NewsCategory::model()->alpha()->findAll(), 'languages' => $this->languages));
 }
コード例 #25
0
ファイル: main.php プロジェクト: Vladimirtishenko/val
<?php 
$this->widget('application.components.widgets.FlashWidget');
?>
<!---- End Flash message ---->

<div class="modal-background-pop-up">
	<div class="arhive -drop-down-pop-up" data-attr="arhive">
	    <?php 
$this->beginWidget('CActiveForm', array('id' => 'srhiv', 'method' => 'get', 'action' => array('/site/search')));
?>
		
	    <?php 
echo CHtml::textField('find', '', array('class' => 'form-control', 'placeholder' => Yii::t('main', 'Шукати...')));
?>
	    <?php 
echo CHtml::dropDownList('category', '', CHtml::listData(NewsCategory::model()->findAll(), 'id', Yii::app()->language == 'ru' ? 'name_ru' : 'name_uk') + array('video' => Yii::t('main', 'Відео'), 'photo' => Yii::t('main', 'Фото')), array('class' => 'form-control', 'placeholder' => Yii::t('main', 'Шукати...'), 'empty' => Yii::t('main', 'Всі категорії')));
?>
	    <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'publishDate', 'language' => 'uk', 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control', 'placeholder' => "Дата...")));
?>
	    <?php 
echo CHtml::tag('button', array('class' => 'btn btn-info'), '<span class="fa fa-search"></span>');
?>
	    <?php 
$this->endWidget();
?>
	</div>



	<div class="logins -drop-down-pop-up" data-attr="login">
コード例 #26
0
 public function CurrentCategory()
 {
     $segment = $this->request->latestParam('ID');
     return NewsCategory::get()->filter('URLSegment', $segment)->First();
 }
コード例 #27
0
<?php

// TODO: Uncomment
include "access.php";
include_once "../includes/SystemConfiguration.class.php";
global $systemConfiguration;
global $logger;
$id = 0;
$errors = array();
$logger->LogInfo("Attempting to delete news category ...");
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $id = intval($_GET['id']);
    if (!NewsCategory::delete($id)) {
        $logger->LogError("Error deleting news category.");
        foreach (NewsCategory::$staticErrors as $error) {
            $logger->LogError($error);
            $errors[] = $error;
        }
    } else {
        header("Location: news_categories_list.php");
    }
} else {
    $errors[] = "Invalid request: category id was not set";
    $logger->LogError("News category id is not set.");
}
include "header.php";
?>


</td>
</tr>
コード例 #28
0
<?php

// TODO: umcomment
include "access.php";
require_once "../includes/SystemConfiguration.class.php";
global $systemConfiguration;
global $logger;
$errors = array();
$logger->LogDebug("Fetching all news categories ...");
$newsCategories = NewsCategory::fetchAllFromDb();
if ($newsCategories == null) {
    $logger->LogError("There were errors fetching nerws categories.");
    foreach (NewsCategory::$staticErrors as $error) {
        $logger->LogError($error);
        $errors[] = $error;
    }
}
$logger->LogDebug("Fetching default language ...");
$defaultLanguage = Language::fetchDefaultLangauge();
if ($defaultLanguage == null) {
    $logger->LogError("There were errors fetching default language.");
    foreach (Language::$staticErrors as $error) {
        $logger->LogError($error);
        $errors[] = $error;
    }
}
include "header.php";
?>
	</td>
  </tr> 
  
コード例 #29
0
 /**
  * @return DataList
  */
 public function NewsCategories()
 {
     return NewsCategory::get();
 }
コード例 #30
0
ファイル: news.php プロジェクト: earthtravels/maxtena
                                    </div>                                                                        
                                    </form>
                                </div>
                                <div class="box_down">
                                </div>
                            </div>
                            <div class="sidebox">
                                <div class="box_top">
                                </div>
                                <div class="sideinner submenu">
                                    <h2><?php 
echo NEWS_CATEGORIES;
?>
</h2>
                                    <?php 
$newsCategories = NewsCategory::fetchFromDbAllUsed($language_selected);
echo "<ul>\n";
foreach ($newsCategories as $newsCategory) {
    echo '<li class="page_item"><a href="' . $this_script . '?category_id=' . $newsCategory->id . '">' . $newsCategory->title->getText($language_selected) . '</a></li>';
}
echo "</ul>\n";
?>
                                    
                                </div>
                                <div class="box_down">
                                </div>
                            </div>
                            <div class="sidebox">
                                <div class="box_top">
                                </div>
                                <div class="sideinner submenu">