예제 #1
0
파일: List.php 프로젝트: brussens/cogear2
 /**
  * Process posts render
  *
  * @param type $posts
  * @return type
  */
 public function process($posts, $pager)
 {
     $output = new Core_ArrayObject();
     foreach ($posts as $post) {
         $post->teaser = TRUE;
         $output->append($post->render());
     }
     event('post.list', $posts);
     $output->append($pager->render());
     return $output->toString();
 }
예제 #2
0
파일: Object.php 프로젝트: romartyn/cogear
 /**
  * Render
  */
 public function render()
 {
     event('grid.render', $this);
     event('grid.render.' . $this->name, $this);
     $output = new Core_ArrayObject();
     foreach ($this as $item) {
         $item->in_grid = TRUE;
         $output->append($item->render($this->item_template));
     }
     $tpl = new Template('Grid.grid');
     $tpl->grid = $this;
     $tpl->data = $output->toString();
     return $tpl->render();
 }
예제 #3
0
파일: Gear.php 프로젝트: brussens/cogear2
 /**
  * Активация шестеренки
  */
 public function enable()
 {
     $result = new Core_ArrayObject(array('success' => TRUE, 'message' => t('Шестеренка активирована!'), 'code' => 1, 'gears' => new Core_ArrayObject()));
     if ($this->status() != Gears::DISABLED) {
         $result->message = t('Шестеренка уже активирована!');
         $result->success = FALSE;
     }
     if ($this->required && FALSE === $this->required->success) {
         $gears_required = new Core_ArrayObject();
         $gears_incomp_version = new Core_ArrayObject();
         $gears_incomp = new Core_ArrayObject();
         foreach ($this->required->gears as $gear) {
             // Несовместимые шестерйнки
             if (Gears::ERROR_INCOMP === $gear->success) {
                 $gears_incomp->append($gear->name);
             }
             // Шестерёнки неправильных версий
             if (Gears::ERROR_VERSION === $gear->success) {
                 $gears_incomp_version->append($gear->name);
             }
             // Необходимые шестерёнки
             if (Gears::ERROR_REQUIRED === $gear->success) {
                 $gears_required->append($gear->name);
             }
         }
         $gears_required->count() && ($result->message = t('Следующие шестерёнки должны быть активированы: ') . '<span class="label label-important">' . $gears_required->toString("</span> <span class='label label-important'>") . "</span>");
         $gears_incomp_version->count() && ($result->message .= '<br/>' . t('Следующие шестеренки должны быть соответствующих версий: ') . '<span class="label label-important">' . $gears_incomp_version->toString("</span> <span class='label label-important'>") . "</span>");
         $gears_incomp->count() && ($result->message .= t('Следующие шестеренки должны быть отключены: ') . '<span class="label label-important">' . $gears_incomp->toString("</span> <span class='label label-important'>") . "</span>");
         $result->success = FALSE;
     }
     $result->success && $this->status(Gears::ENABLED);
     event('gear.enable', $this, $result);
     return $result;
 }