예제 #1
0
파일: Model.php 프로젝트: ukrcms/ukrcms
 public function getViewUrl()
 {
     if (!empty($this->category_id)) {
         $categories = \Ub\Simpleblog\Categories\Table::instance()->getAllFromCache();
         if (!empty($categories)) {
             $category = $categories[$this->category_id];
         } else {
             $category = $this->category();
         }
         if (!empty($category)) {
             $params = array('postsef' => $this->sef, 'postpk' => $this->pk(), 'catsef' => $category->sef, 'catpk' => $category->pk());
             return \Uc::app()->url->create('ub/simpleblog/posts/view', $params);
         }
     }
     return '#error';
 }
예제 #2
0
 /**
  * @author  Ivan Scherbak <*****@*****.**> 8/22/12
  * @throws \Exception
  */
 public function actionCategory()
 {
     $params = \Uc::app()->url->getParams();
     if (!empty($params['catpk']) and $pk = $params['catpk']) {
         $categories = \Ub\Simpleblog\Categories\Table::instance()->getAllFromCache();
         $currentCategory = isset($categories[$pk]) ? $categories[$pk] : false;
     }
     if (empty($currentCategory)) {
         throw new \Exception('No category', 404);
     }
     \Uc::app()->theme->setValue('simpleblog_category_id', $currentCategory->pk());
     //@todo make redirect if current sef is not valid (/aaaaa-c1/ to /test-category-c1/)
     # set meta tags for this category
     $this->setSeoMetaFromModel($currentCategory);
     $this->category = $currentCategory;
     $this->showPostList($currentCategory->pk());
 }
예제 #3
0
파일: edit.php 프로젝트: ukrcms/ukrcms
?>
" required/>
    </div>

    <div class="element">
      <label for="sef">sef <span class="red">(обов'язково)</span></label>
      <input id="sef" name="data[sef]" class="text" value="<?php 
echo $model->sef;
?>
" required/>
    </div>

    <div class="element">
      <label for="category">Категорія<span class="red">(обов'язково)</span></label>
      <?php 
$categories = \Ub\Simpleblog\Categories\Table::instance()->fetchAll();
?>
      <select id="category" name="data[category_id]">
        <?php 
foreach ($categories as $category) {
    ?>
          <option value="<?php 
    echo $category->pk();
    ?>
" <?php 
    echo $category->pk() == $model->category_id ? 'selected="selected"' : '';
    ?>
><?php 
    echo $category->title;
    ?>
</option>
예제 #4
0
 protected function getConnectedTable()
 {
     return \Ub\Simpleblog\Categories\Table::instance();
 }