예제 #1
0
 public function view()
 {
     $key = \Key::getCurrent();
     if (!\Key::checkKey($key)) {
         return;
     }
     $tpl = array();
     $allSettings = $this->settings->getAll();
     foreach ($allSettings as $key => $value) {
         if ($value == 1) {
             $tpl[$key] = "";
             // dummy template
         }
     }
     $content = \PHPWS_Template::process($tpl, 'addthis', 'addThis.tpl');
     \Layout::add($content, 'addthis', 'DEFAULT');
 }
예제 #2
0
 /**
  * Fills in the meta description with the current key summary.
  */
 public static function keyDescriptions()
 {
     if (!PHPWS_Settings::get('layout', 'use_key_summaries')) {
         return;
     }
     $key = Key::getCurrent();
     if (!Key::checkKey($key, false)) {
         return NULL;
     }
     if (!empty($key->summary)) {
         $GLOBALS['Layout_Description'] =& $key->summary;
     } elseif (!empty($key->title)) {
         $GLOBALS['Layout_Description'] =& $key->title;
     }
 }
예제 #3
0
<?php

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
Block::show();
if (Current_User::allow('block')) {
    $key = Key::getCurrent();
    if (Key::checkKey($key) && javascriptEnabled()) {
        javascript('jquery');
        javascript('ckeditor');
        $js_address = PHPWS_SOURCE_HTTP . 'mod/block/javascript/addblock/script.js';
        Layout::addJSHeader('<script src="' . $js_address . '" type="text/javascript"></script>', 'addblock');
        $modal = new \Modal('block-form-modal', '<div id="block-form-dialog"></div>', 'Add block here');
        $modal->sizeLarge();
        $save_button = '<button class="btn btn-success" id="save-block">Save</button>';
        $modal->addButton($save_button);
        Layout::add((string) $modal);
        MiniAdmin::add('block', '<a style="cursor:pointer" data-auth-key="' . Current_User::getAuthKey() . '" data-key-id="' . $key->id . '" id="add-block"><i class="fa fa-plus"></i> Add block here</a>');
    }
}
예제 #4
0
 public static function permission()
 {
     if (!isset($_REQUEST['key_id'])) {
         return;
     }
     $key = new Key((int) $_REQUEST['key_id']);
     if (!Key::checkKey($key, false)) {
         return;
     }
     if (Current_User::isRestricted($key->module) || !$key->allowEdit()) {
         Current_User::disallow();
     }
     // View permissions must be first to allow error checking
     // Edit will add its list to the view
     Users_Permission::postViewPermissions($key);
     Users_Permission::postEditPermissions($key);
     $result = $key->savePermissions();
     if (isset($_POST['popbox'])) {
         Layout::nakedDisplay(javascript('close_refresh', array('refresh' => 0)));
     } else {
         if (PHPWS_Error::logIfError($result)) {
             $_SESSION['Permission_Message'] = dgettext('users', 'An error occurred.');
         } else {
             $_SESSION['Permission_Message'] = dgettext('users', 'Permissions updated.');
         }
         PHPWS_Core::goBack();
     }
 }