Example #1
0
 /**
  * Get the correct view for the form
  *
  * @param $view
  * @return View|null|Template
  */
 public function getView($view)
 {
     if (Template::exists('Form/' . $view)) {
         return Template::getAdminTemplate('Form/' . $view);
     }
     return new View($view, B8_PATH . 'Form/View/');
 }
Example #2
0
 protected function loadTimeline()
 {
     $logStore = Store::get('Log');
     $items = $logStore->getTimeline();
     $timeline = [];
     $lastDate = new \DateTime('1970-01-01');
     foreach ($items as $item) {
         if ($item->getLogDate()->format('Y-m-d') != $lastDate->format('Y-m-d')) {
             $date = $item->getLogDate()->format('M j Y');
             $timeline[] = "<li class=\"time-label\">\n                                    <span class=\"bg-blue\">\n                                        {$date}\n                                    </span>\n                                </li>";
             $lastDate = $item->getLogDate();
         }
         $keyDate = $item->getLogDate()->format('Y-m-d');
         $key = md5($keyDate . $item->getScope() . '.' . $item->getType() . '.' . $item->getScopeId());
         if (array_key_exists($key, $timeline)) {
             continue;
         }
         $template = 'Dashboard/Timeline/' . $item->getScope();
         if (!Template::exists($template)) {
             $template = 'Dashboard/Timeline/default';
         }
         $template = Template::getAdminTemplate($template);
         $template->icon = 'info';
         $template->item = $item;
         $template->decoded = @json_decode($item->getMessage(), true);
         switch ($item->getType()) {
             case 2:
                 $template->color = 'green';
                 $template->verb = 'created';
                 break;
             case 4:
                 $template->color = 'red';
                 $template->verb = 'deleted';
                 break;
             case 8:
                 $template->color = 'blue';
                 $template->verb = 'edited';
                 break;
             case 128:
                 $template->color = 'blue';
                 $template->verb = 'published';
                 break;
         }
         switch ($item->getScope()) {
             case 'user':
                 $template->icon = 'user';
                 break;
             case 'page':
                 $template->icon = 'file-text';
                 break;
             case 'file':
                 $template->icon = 'image';
                 break;
             case 'info':
                 $template->icon = 'user';
                 break;
         }
         $timeline[$key] = $template->render();
         if (count($timeline) >= 20) {
             break;
         }
     }
     return $timeline;
 }
Example #3
0
 protected function setupLegacyTemplate($controller, $action)
 {
     if (LegacyTemplate::exists($controller . '/' . $action)) {
         $this->template = new Template('legacy', 'admin');
         $this->view = LegacyTemplate::getAdminTemplate($controller . '/' . $action);
         $this->view->currentUser = $this->currentUser;
     }
 }