Exemple #1
0
 public function getTpl()
 {
     $vars['block_id'] = $this->getId();
     if (Current_User::allow('block', 'edit_block', $this->id)) {
         $vars['action'] = 'edit';
         $links[] = PHPWS_Text::secureLink(Icon::show('edit', dgettext('block', 'Edit')), 'block', $vars);
         if ($this->allPinned()) {
             $vars['action'] = 'remove';
             $links[] = PHPWS_Text::secureLink("<i class='fa fa-flag' title='" . dgettext('block', 'Remove block from all pages') . "'></i>", 'block', $vars);
         } else {
             $vars['action'] = 'pin_all';
             $links[] = PHPWS_Text::secureLink("<i class='fa fa-flag-o' title='" . dgettext('block', 'Display block on all pages') . "'></i>", 'block', $vars);
         }
         if (Current_User::isUnrestricted('block')) {
             $links[] = Current_User::popupPermission($this->key_id, null, 'icon');
         }
     }
     if (Current_User::allow('block', 'delete_block')) {
         $vars['action'] = 'delete';
         $confirm_vars['QUESTION'] = dgettext('block', 'Are you sure you want to permanently delete this block?');
         $confirm_vars['ADDRESS'] = PHPWS_Text::linkAddress('block', $vars, TRUE);
         $confirm_vars['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('block', 'Delete') . '"></i>';
         $links[] = javascript('confirm', $confirm_vars);
     }
     if (!empty($links)) {
         $template['ACTION'] = implode('', $links);
     } else {
         $template['ACTION'] = ' ';
     }
     if (empty($this->title)) {
         $template['TITLE'] = '<em>' . dgettext('block', 'Untitled') . '</em>';
     }
     if (empty($this->content)) {
         $template['CONTENT'] = '<em>' . dgettext('block', 'Empty') . '</em>';
     } else {
         $template['CONTENT'] = $this->summarize();
     }
     return $template;
 }
Exemple #2
0
 public function rowTags()
 {
     PHPWS_Core::requireConfig('filecabinet', 'config.php');
     if (FC_ICON_PAGER_LINKS) {
         $mode = 'icon';
         $spacer = '';
     } else {
         $mode = null;
         $spacer = ' | ';
     }
     //$icon = sprintf('<img src="%s" />', $this->icon);
     $vars['aop'] = 'view_folder';
     $vars['folder_id'] = $this->id;
     $tpl['TITLE'] = PHPWS_Text::moduleLink($this->title, 'filecabinet', $vars);
     $tpl['ITEMS'] = $this->tallyItems();
     if (Current_User::allow('filecabinet', 'edit_folders', $this->id, 'folder')) {
         $links[] = $this->editLink('image');
         $links[] = $this->uploadLink('icon');
     }
     if (Current_User::allow('filecabinet', 'edit_folders', $this->id, 'folder', true)) {
         if ($this->key_id) {
             $links[] = Current_User::popupPermission($this->key_id, null, $mode);
         }
     }
     if (Current_User::allow('filecabinet', 'delete_folders', null, null, true)) {
         $links[] = $this->deleteLink('image');
     }
     $mods = PHPWS_Core::getModuleNames();
     if ($this->module_created && isset($mods[$this->module_created])) {
         $tpl['MODULE_CREATED'] = $mods[$this->module_created];
     } else {
         $tpl['MODULE_CREATED'] = dgettext('filecabinet', 'General');
     }
     $tpl['PUBLIC'] = $this->getPublic();
     if (@$links) {
         $tpl['LINKS'] = implode($spacer, $links);
     }
     return $tpl;
 }
Exemple #3
0
 public function rowTag()
 {
     $vars['sheet_id'] = $this->id;
     if (Current_User::allow('signup', 'edit_sheet', $this->id, 'sheet')) {
         if (Current_User::isUnrestricted('signup')) {
             $vars['aop'] = 'edit_sheet';
             $links[] = PHPWS_Text::secureLink(\Icon::show('edit', dgettext('signup', 'Edit')), 'signup', $vars);
         }
         $vars['aop'] = 'edit_slots';
         $links[] = PHPWS_Text::secureLink(\Icon::show('th-list', dgettext('signup', 'Slots')), 'signup', $vars);
         if (Current_User::isUnrestricted('signup')) {
             $links[] = Current_User::popupPermission($this->key_id, null, 'icon');
         }
     }
     $vars['aop'] = 'report';
     $links[] = PHPWS_Text::secureLink(\Icon::show('file-text', dgettext('signup', 'Report')), 'signup', $vars);
     if (Current_User::isUnrestricted('signup')) {
         $vars['aop'] = 'delete_sheet';
         $js['ADDRESS'] = PHPWS_Text::linkAddress('signup', $vars, true);
         $js['QUESTION'] = dgettext('signup', 'Are you sure you want to delete this sheet?\\nAll slots and signup information will be permanently removed.');
         $js['LINK'] = \Icon::show('delete');
         $links[] = javascript('confirm', $js);
     }
     $tpl['START_TIME'] = strftime("%D %R", $this->start_time);
     // MM/DD/YY hh:mm 24-hour time format
     $tpl['END_TIME'] = strftime("%D %R", $this->end_time);
     // MM/DD/YY hh:mm 24-hour time format
     $tpl['TITLE'] = $this->viewLink();
     $tpl['ACTION'] = implode('&nbsp;', $links);
     return $tpl;
 }
Exemple #4
0
 public static function permissionMenu()
 {
     $key = Key::getCurrent();
     if (empty($key) || $key->isDummy() || empty($key->edit_permission)) {
         return;
     }
     if (Current_User::isUnrestricted($key->module) && Current_User::allow($key->module, $key->edit_permission)) {
         if (!javascriptEnabled()) {
             $tpl = User_Form::permissionMenu($key);
             $content = PHPWS_Template::process($tpl, 'users', 'forms/permission_menu.tpl');
             Layout::add($content, 'users', 'permissions');
         } else {
             $links[] = Current_User::popupPermission($key->id, sprintf(dgettext('users', 'Set permissions'), $key->title));
             MiniAdmin::add('users', $links);
         }
     }
 }