コード例 #1
0
ファイル: Conquer.php プロジェクト: frenchfrogs/framework
 /**
  *
  *
  * @param \FrenchFrogs\Ruler\Page\Page $page
  * @return string
  */
 public function page(Ruler\Page\Page $page)
 {
     // attribute initialization
     $indicator = $children = '';
     // label
     $html = '<span class="title">' . $page->getLabel() . '</span>';
     if ($current = $page->isCurrent()) {
         $indicator .= ' selected';
     }
     // Render child page
     if ($page->hasChildren()) {
         // add arrow icon
         $indicator .= ' arrow';
         foreach ($page->getChildren() as $p) {
             /**@var Ruler\Page\Page $p*/
             $class = '';
             if ($p->isCurrent()) {
                 $page->addClass('active');
                 // active for parent page
                 $class = 'class="active"';
             }
             if ($p->hasPermission() && !\ruler()->hasPermission($p->getPermission())) {
                 continue;
             }
             $children .= '<li ' . $class . '>' . html('a', ['href' => $p->getLink()], $p->getLabel()) . '</li>';
         }
         $children = '<ul class="sub-menu">' . $children . '</ul>';
         // overcharge link for javascript opening menu
         $page->setLink('javascript:;');
     }
     // render all
     $html .= '<span class="' . $indicator . '"></span>';
     $html = html('a', ['href' => $page->getLink()], $html);
     $html .= $children;
     return $html;
 }
コード例 #2
0
 /**
  * Execute a command
  *
  * @param $id
  * @return mixed
  * @throws \Exception
  */
 public function postExecute($id)
 {
     \ruler()->check($this->permission, ['id' => 'required|exists:schedule,schedule_id'], ['id' => $id]);
     try {
         // Récuperation du model
         $schedule = Db\Schedule\Schedule::findOrFail($id);
         \Artisan::call($schedule->command);
         \js()->success()->reloadDataTable();
     } catch (\Exception $e) {
         \js()->error($e->getMessage());
     }
     return \js();
 }
コード例 #3
0
ファイル: AclController.php プロジェクト: frenchfrogs/acl
 /**
  * Suppression d'un utilisateur
  *
  */
 public function deleteUser($id)
 {
     //RULER
     \ruler()->check($this->permission, ['id' => 'exists:user,user_id'], ['id' => $uuid = f($id, 'uuid')]);
     // MODEL
     $model = User::findOrFail($uuid);
     // MODAL
     $modal = \modal(null, 'Etes vous sûr de vouloir supprimer : <b>' . $model->name . '</b>');
     $button = (new \FrenchFrogs\Form\Element\Button('yes', 'Supprimer !'))->setOptionAsDanger()->enableCallback('delete')->addAttribute('href', request()->url() . '?delete=1');
     $modal->appendAction($button);
     // TRAITEMENT
     if (\request()->has('delete')) {
         try {
             $model->delete();
             \js()->success()->closeRemoteModal()->reloadDataTable();
         } catch (\Exception $e) {
             \js()->error($e->getMessage());
         }
         return js();
     }
     return response()->modal($modal);
 }
コード例 #4
0
 /**
  * List all references
  *
  * @return \Illuminate\View\View
  */
 public function getIndex()
 {
     \ruler()->check($this->permission);
     return basic('Références', static::reference());
 }