コード例 #1
0
ファイル: Listeners.php プロジェクト: rmaiwald/Scribite
 /**
  * Event listener for 'core.postinit' event.
  * 
  * @param Zikula_Event $event
  *
  * @return void
  */
 public static function coreinit(Zikula_Event $event)
 {
     // get the module name
     $args = array();
     $args['modulename'] = ModUtil::getName();
     $module = $args['modulename'];
     // exit if Content module active - to avoid double loadings if user has given ids and functions
     if ($args['modulename'] == 'content') {
         return;
     }
     // Security check if user has COMMENT permission for scribite
     if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) {
         return;
     }
     // get passed func
     $func = FormUtil::getPassedValue('func', isset($args['func']) ? $args['func'] : null, 'GET');
     // get config for current module
     $modconfig = array();
     $modconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => $args['modulename']));
     // return if module is not supported or editor is not set
     if (!$modconfig['mid'] || $modconfig['modeditor'] == '-') {
         return;
     }
     // check if current func is fine for editors or funcs is empty (or all funcs)
     if (is_array($modconfig['modfuncs']) && (in_array($func, $modconfig['modfuncs']) || $modconfig['modfuncs'][0] == 'all')) {
         $args['areas'] = $modconfig['modareas'];
         $args['editor'] = $modconfig['modeditor'];
         $scribite = ModUtil::apiFunc('Scribite', 'user', 'loader', array('modulename' => $args['modulename'], 'editor' => $args['editor'], 'areas' => $args['areas']));
         // add the scripts to page header
         if ($scribite) {
             PageUtil::AddVar('header', $scribite);
         }
     }
 }
コード例 #2
0
ファイル: PageUtil.php プロジェクト: AxelPanda/ibos
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #3
0
ファイル: Filter.php プロジェクト: Silwereth/core
 /**
  * Inject header assets into the head of the raw source of a page (before </head>)
  * Inject footer assets into the foot of the raw source of a page (before </body>)
  *
  * @param string $source
  * @param array $js
  * @param array $css
  * @return string
  */
 public function filter($source, $js = array(), $css = array())
 {
     if (!empty($css)) {
         $this->cssResolver->getBag()->add($css);
     }
     if (!empty($js)) {
         $this->jsResolver->getBag()->add($js);
     }
     // compile and replace head
     $header = $this->cssResolver->compile();
     $header .= \JCSSUtil::getJSConfig();
     // must be included before other scripts because it defines `Zikula` JS namespace
     $header .= $this->scriptPosition == 'head' ? $this->jsResolver->compile() : '';
     $header .= implode("\n", $this->headers->all()) . "\n";
     $header .= trim(implode("\n", \PageUtil::getVar('header')) . "\n");
     // @todo legacy - remove at Core-2.0
     if (strripos($source, '</head>')) {
         $source = str_replace('</head>', $header . "\n</head>", $source);
     }
     // compile and replace foot
     $footer = $this->scriptPosition == 'foot' ? $this->jsResolver->compile() : '';
     $footer .= trim(implode("\n", $this->footers->all()) . "\n");
     $footer .= trim(implode("\n", \PageUtil::getVar('footer')) . "\n");
     // @todo legacy - remove at Core-2.0
     if (false === empty($footer)) {
         $source = str_replace('</body>', $footer . "\n</body>", $source);
     }
     return $source;
 }
コード例 #4
0
/**
 * AddressBook
 *
 * @copyright (c) AddressBook Development Team
 * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @package AddressBook
 */
function smarty_function_AddressShowGmap($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('AddressBook');
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $directions = '';
    if (isset($params['directions'])) {
        $directions = '<a href="http://maps.google.com/maps?f=d&daddr=' . $params['lat_long'];
        if (isset($params['zoomlevel'])) {
            $directions .= '&z=' . $params['zoomlevel'];
        }
        $directions .= '" target="_blank">' . __('Get directions to this location', $dom) . '</a>';
    }
    if (!empty($directions)) {
        $directions = '<div>' . $directions . '</div>';
    }
    include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
    $map_id = 'googlemap';
    if (isset($params['mapid'])) {
        $map_id .= $params['mapid'];
    }
    $app_id = 'ZikulaAddressBook';
    $map = new GoogleMapAPI($map_id, $app_id);
    if (isset($params['maptype'])) {
        $map->setMapType($params['maptype']);
        // hybrid, satellite, terrain, roadmap
    }
    if (isset($params['zoomlevel'])) {
        $map->setZoomLevel($params['zoomlevel']);
    }
    $map->setTypeControlsStyle('dropdown');
    $map->setWidth(isset($params['width']) && $params['width'] ? $params['width'] : '100%');
    $map->setHeight(isset($params['height']) && $params['height'] ? $params['height'] : '400px');
    // handle one (center) point
    if (isset($params['lat_long'])) {
        $arrLatLong = explode(',', $params['lat_long']);
        $map->setCenterCoords($arrLatLong[1], $arrLatLong[0]);
        $map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $params['title'], $params['html'], $params['tooltip'], $params['icon'], $params['iconshadow']);
    }
    // API key
    if (isset($params['api_key'])) {
        $map->setApiKey($params['api_key']);
    }
    // handle array of points
    if (isset($params['points'])) {
        foreach ($params['points'] as $point) {
            $arrLatLong = explode(',', $point['lat_long']);
            $map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $point['title'], $point['html'], $point['tooltip'], $point['icon'], $point['iconshadow']);
        }
    }
    // load the map
    $map->enableOnLoad();
    if ($assign) {
        $result = $map->getHeaderJS() . $map->getMapJS() . $directions . $map->printMap() . $map->printOnLoad();
        $smarty->assign($assign, $result);
    } else {
        PageUtil::addVar('rawtext', $map->getHeaderJS());
        PageUtil::addVar('rawtext', $map->getMapJS());
        return $directions . $map->printMap() . $map->printOnLoad();
    }
}
コード例 #5
0
ファイル: ClonePage.php プロジェクト: projectesIF/Sirius
    public function initialize(Zikula_Form_View $view)
    {
        $this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);

        if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }
        if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }

        $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'filter' => array('checkActive' => false), 'includeContent' => false));
        if ($page === false) {
            throw new Zikula_Exception_Fatal($this->__('Page not found'));
        }

        // Only allow subpages if edit access on parent page
        if (!SecurityUtil::checkPermission('Content:page:', $page['id'] . '::', ACCESS_EDIT)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }

        PageUtil::setVar('title', $this->__('Clone page') . ' : ' . $page['title']);

        $this->view->assign('page', $page);
        Content_Util::contentAddAccess($this->view, $this->pageId);

        return true;
    }
コード例 #6
0
 /**
  * This function generate 
  *
  * @return RedirectResponse
  */
 public function managerAction(Request $request, $obj_reference = null, $mode = 'info')
 {
     // Permission check
     if (!$this->get('kaikmedia_gallery_module.access_manager')->hasPermission()) {
         throw new AccessDeniedException();
     }
     $gallerySettings = ['mode' => $mode, 'obj_reference' => $obj_reference];
     $masterRequest = $this->get('request_stack')->getMasterRequest();
     $gallerySettings['obj_name'] = $masterRequest->attributes->get('_zkModule');
     /*
     $addMediaForm = $this->createForm(
             new AddMediaType(), null , ['allowed_mime_types' => $this->get('kaikmedia_gallery_module.settings_manager')->getAllowedMimeTypesForObject($gallerySettings['obj_name']),
                                   'isXmlHttpRequest' => $request->isXmlHttpRequest()]
             
     );
     */
     //$gallerySettings['mediaTypes'] = $this->get('kaikmedia_gallery_module.media_handlers_manager')->getSupportedMimeTypes();
     $gallerySettings['settings'] = $this->get('kaikmedia_gallery_module.settings_manager')->getSettingsArray();
     \PageUtil::addVar('javascript', "@KaikmediaGalleryModule/Resources/public/js/Kaikmedia.Gallery.settings.js");
     \PageUtil::addVar('javascript', "@KaikmediaGalleryModule/Resources/public/js/Kaikmedia.Gallery.mediaItem.js");
     \PageUtil::addVar('javascript', "@KaikmediaGalleryModule/Resources/public/js/Kaikmedia.Gallery.Manager.js");
     \PageUtil::addVar('stylesheet', "@KaikmediaGalleryModule/Resources/public/css/gallery.manager.css");
     \PageUtil::addVar('stylesheet', "@KaikmediaGalleryModule/Resources/public/css/gallery.mediaItem.css");
     $request->attributes->set('_legacy', true);
     // forces template to render inside old theme
     return $this->render('KaikmediaGalleryModule:Plugin:manager.html.twig', array('gallerySettings' => $gallerySettings));
 }
コード例 #7
0
ファイル: block.form.php プロジェクト: Silwereth/core
/**
 * Smarty function to wrap Zikula_Form_View generated form controls with suitable form tags.
 *
 * @param array            $params  Parameters passed in the block tag.
 * @param string           $content Content of the block.
 * @param Zikula_Form_View $view    Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_block_form($params, $content, $view)
{
    if ($content) {
        PageUtil::AddVar('stylesheet', 'system/ThemeModule/Resources/public/css/form/style.css');
        $action = htmlspecialchars(System::getCurrentUri());
        $classString = '';
        $roleString = '';
        if (isset($params['cssClass'])) {
            $classString = "class=\"{$params['cssClass']}\" ";
        }
        if (isset($params['role'])) {
            $roleString = "role=\"{$params['role']}\" ";
        }
        $enctype = array_key_exists('enctype', $params) ? $params['enctype'] : null;
        // if enctype is not set directly, check whenever upload plugins were used;
        // if so - set proper enctype for file upload
        if (is_null($enctype)) {
            $uploadPlugins = array_filter($view->plugins, function ($plugin) {
                return $plugin instanceof Zikula_Form_Plugin_UploadInput;
            });
            if (!empty($uploadPlugins)) {
                $enctype = 'multipart/form-data';
            }
        }
        $encodingHtml = !is_null($enctype) ? " enctype=\"{$enctype}\"" : '';
        $onSubmit = isset($params['onsubmit']) ? " onSubmit=\"{$params['onsubmit']}\"" : '';
        $view->postRender();
        $formId = $view->getFormId();
        $out = "\n<form id=\"{$formId}\" {$roleString}{$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}{$onSubmit}>\n    {$content}\n    <div>\n        {$view->getStateHTML()}\n        {$view->getStateDataHTML()}\n        {$view->getIncludesHTML()}\n        {$view->getCsrfTokenHtml()}\n        <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n        <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n        <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n        <script type=\"text/javascript\">\n        <!--\n            function FormDoPostBack(eventTarget, eventArgument)\n            {\n                var f = document.getElementById('{$formId}');\n                if (!f.onsubmit || f.onsubmit()) {\n                    f.FormEventTarget.value = eventTarget;\n                    f.FormEventArgument.value = eventArgument;\n                    f.submit();\n                }\n            }\n        // -->\n        </script>\n    </div>\n</form>\n";
        return $out;
    }
}
コード例 #8
0
ファイル: FocusController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     if (isset($_GET["pagesize"])) {
         $this->setListPageSize($_GET["pagesize"]);
     }
     $key = StringUtil::filterCleanHtml(EnvUtil::getRequest("keyword"));
     $fields = array("frp.runid", "frp.processid", "frp.flowprocess", "frp.flag", "frp.opflag", "frp.processtime", "ft.freeother", "ft.flowid", "ft.name as typeName", "ft.type", "ft.listfieldstr", "fr.name as runName", "fr.beginuser", "fr.begintime", "fr.endtime", "fr.focususer");
     $sort = "frp.processtime";
     $group = "frp.runid";
     $condition = array("and", "fr.delflag = 0", "frp.childrun = 0", sprintf("frp.uid = %d", $this->uid), sprintf("FIND_IN_SET(fr.focususer,'%s')", $this->uid));
     if ($key) {
         $condition[] = array("like", "fr.runid", "%{$key}%");
         $condition[] = array("or like", "fr.name", "%{$key}%");
     }
     $count = Ibos::app()->db->createCommand()->select("count(*) as count")->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->group($group)->queryScalar();
     $pages = PageUtil::create($count, $this->getListPageSize());
     if ($key && $count) {
         $pages->params = array("keyword" => $key);
     }
     $offset = $pages->getOffset();
     $limit = $pages->getLimit();
     $list = Ibos::app()->db->createCommand()->select($fields)->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order($sort)->group($group)->offset($offset)->limit($limit)->queryAll();
     $data = array_merge(array("pages" => $pages), $this->handleList($list));
     $this->setPageTitle(Ibos::lang("My focus"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang(Ibos::lang("My focus")), "url" => $this->createUrl("focus/index")), array("name" => Ibos::lang("List"))));
     $this->render("index", $data);
 }
コード例 #9
0
ファイル: User.php プロジェクト: projectesIF/Sirius
    public function pageLock($args)
    {
        $lockName = $args['lockName'];
        $returnUrl = (array_key_exists('returnUrl', $args) ? $args['returnUrl'] : null);
        $ignoreEmptyLock = (array_key_exists('ignoreEmptyLock', $args) ? $args['ignoreEmptyLock'] : false);

        $uname = UserUtil::getVar('uname');

        $lockedHtml = '';

        if (!empty($lockName) || !$ignoreEmptyLock) {
            PageUtil::AddVar('javascript', 'zikula.ui');
            PageUtil::AddVar('javascript', 'system/PageLock/javascript/pagelock.js');
            PageUtil::AddVar('stylesheet', ThemeUtil::getModuleStylesheet('pagelock'));

            $lockInfo = ModUtil::apiFunc('pagelock', 'user', 'requireLock',
                    array('lockName'      => $lockName,
                    'lockedByTitle' => $uname,
                    'lockedByIPNo'  => $_SERVER['REMOTE_ADDR']));

            $hasLock = $lockInfo['hasLock'];

            if (!$hasLock) {
                $view = Zikula_View::getInstance('pagelock');
                $view->assign('lockedBy', $lockInfo['lockedBy']);
                $lockedHtml = $view->fetch('PageLock_lockedwindow.tpl');
            }
        } else {
            $hasLock = true;
        }

        $html = "<script type=\"text/javascript\">/* <![CDATA[ */ \n";

        if (!empty($lockName)) {
            if ($hasLock) {
                $html .= "document.observe('dom:loaded', PageLock.UnlockedPage);\n";
            } else {
                $html .= "document.observe('dom:loaded', PageLock.LockedPage);\n";
            }
        }

        $lockedHtml = str_replace("\n", "", $lockedHtml);
        $lockedHtml = str_replace("\r", "", $lockedHtml);

        // Use "PageLockLifetime*2/3" to add a good margin to lock timeout when pinging

        // disabled due to #2556 and #2745
        // $returnUrl = DataUtil::formatForDisplayHTML($returnUrl);

        $html .= "
PageLock.LockName = '$lockName';
PageLock.ReturnUrl = '$returnUrl';
PageLock.PingTime = " . (PageLockLifetime*2/3) . ";
PageLock.LockedHTML = '" . $lockedHtml . "';
 /* ]]> */</script>";

        PageUtil::addVar('header', $html);

        return true;
    }
コード例 #10
0
ファイル: HistoryContent.php プロジェクト: robbrandt/Content
 public function initialize(Zikula_Form_View $view)
 {
     $this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
     $offset = (int) FormUtil::getPassedValue('offset');
     if ((bool) $this->getVar('inheritPermissions', false) === true) {
         if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     } else {
         if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     }
     $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => false, 'filter' => array('checkActive' => false), 'enableEscape' => true, 'translate' => false, 'includeContent' => false, 'includeCategories' => false));
     if ($page === false) {
         return $this->view->registerError(null);
     }
     $versionscnt = ModUtil::apiFunc('Content', 'History', 'getPageVersionsCount', array('pageId' => $this->pageId));
     $versions = ModUtil::apiFunc('Content', 'History', 'getPageVersions', array('pageId' => $this->pageId, 'offset' => $offset));
     if ($versions === false) {
         return $this->view->registerError(null);
     }
     $this->view->assign('page', $page);
     $this->view->assign('versions', $versions);
     Content_Util::contentAddAccess($this->view, $this->pageId);
     // Assign the values for the smarty plugin to produce a pager
     $this->view->assign('numitems', $versionscnt);
     PageUtil::setVar('title', $this->__("Page history") . ' : ' . $page['title']);
     if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
         $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
     }
     return true;
 }
コード例 #11
0
 public function pageAddVar($name, $value = null)
 {
     if (in_array($name, array('stylesheet', 'javascript'))) {
         $value = explode(',', $value);
     }
     \PageUtil::addVar($name, $value);
 }
コード例 #12
0
ファイル: PositionController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     $catId = intval(EnvUtil::getRequest("catid"));
     if (EnvUtil::submitCheck("search")) {
         $key = $_POST["keyword"];
         $list = Position::model()->fetchAll("`posname` LIKE '%{$key}%'");
     } else {
         $catContidion = empty($catId) ? "" : "catid = {$catId}";
         $count = Position::model()->count($catContidion);
         $pages = PageUtil::create($count);
         $list = Position::model()->fetchAllByCatId($catId, $pages->getLimit(), $pages->getOffset());
         $data["pages"] = $pages;
     }
     foreach ($list as $k => $pos) {
         $list[$k]["num"] = User::model()->count("positionid = :positionid AND status != 2", array(":positionid" => $pos["positionid"]));
     }
     $data["catid"] = $catId;
     $catData = PositionUtil::loadPositionCategory();
     $data["catData"] = $catData;
     $data["list"] = $list;
     $data["category"] = StringUtil::getTree($catData, $this->selectFormat);
     $this->setPageTitle(Ibos::lang("Position manager"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("Position manager"))));
     $this->render("index", $data, false, array("category"));
 }
コード例 #13
0
/**
 * Smarty function to display the category menu for admin links. This also adds the
 * navtabs.css to the page vars array for stylesheets.
 *
 * Admin
 * {admincategorymenu}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategoreymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $view        Reference to the Zikula_View object
 * @return       string      the results of the module function
 */
function smarty_function_admincategorymenu($params, $view)
{
    PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
    $modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
    $acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
    return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
コード例 #14
0
/**
 * Smarty function to display the category menu for admin links. This also adds the
 * navtabs.css to the page vars array for stylesheets.
 *
 * Admin
 * {admincategorymenu}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategorymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        \Zikula_View $view        Reference to the Zikula_View object
 * @return       string      the results of the module function
 */
function smarty_function_admincategorymenu($params, \Zikula_View $view)
{
    PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('ZikulaAdminModule'));
    $modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
    $acid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
    $path = array('_controller' => 'ZikulaAdminModule:Admin:categorymenu', 'acid' => $acid);
    $subRequest = $view->getRequest()->duplicate(array(), null, $path);
    return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
コード例 #15
0
 public function initialize(Zikula_Form_View $view)
 {
     $this->contentId = (int) FormUtil::getPassedValue('cid', isset($this->args['cid']) ? $this->args['cid'] : -1);
     $this->language = ZLanguage::getLanguageCode();
     $content = ModUtil::apiFunc('Content', 'Content', 'getContent', array('id' => $this->contentId, 'language' => $this->language, 'translate' => false));
     if ($content === false) {
         return $this->view->registerError(null);
     }
     $this->contentType = ModUtil::apiFunc('Content', 'Content', 'getContentType', $content);
     if ($this->contentType === false) {
         return $this->view->registerError(null);
     }
     $this->pageId = $content['pageId'];
     if ((bool) $this->getVar('inheritPermissions', false) === true) {
         if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     } else {
         if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     }
     $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'includeContent' => false, 'filter' => array('checkActive' => false)));
     if ($page === false) {
         return $this->view->registerError(null);
     }
     if ($this->language == $page['language']) {
         return $this->view->registerError(LogUtil::registerError($this->__f('Sorry, you cannot translate an item to the same language as it\'s default language ("%1$s"). Change the current site language ("%2$s") to some other language on the <a href="%3$s">localisation settings</a> page.<br /> Another way is to add, for instance, <strong>&amp;lang=de</strong> to the url for changing the current site language to German and after that the item can be translated to German.', array($page['language'], $this->language, ModUtil::url('Settings', 'admin', 'multilingual')))));
     }
     $translationInfo = ModUtil::apiFunc('Content', 'Content', 'getTranslationInfo', array('contentId' => $this->contentId));
     if ($translationInfo === false) {
         return $this->view->registerError(null);
     }
     PageUtil::setVar('title', $this->__("Translate content item") . ' : ' . $page['title']);
     $templates = $this->contentType['plugin']->getTranslationTemplates();
     $this->view->assign('translationtemplates', $templates);
     $this->view->assign('page', $page);
     $this->view->assign('data', $content['data']);
     $this->view->assign('isTranslatable', $content['isTranslatable']);
     $this->view->assign('translated', isset($content['translated']) ? $content['translated'] : array());
     $this->view->assign('translationInfo', $translationInfo);
     $this->view->assign('translationStep', $this->contentId);
     $this->view->assign('language', $this->language);
     $this->view->assign('contentType', $this->contentType);
     Content_Util::contentAddAccess($this->view, $this->pageId);
     if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
         $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
     }
     if ($this->backref != null) {
         $returnUrl = $this->backref;
     } else {
         $returnUrl = ModUtil::url('Content', 'admin', 'editpage', array('pid' => $this->pageId));
     }
     ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentTranslateContent{$this->contentId}", 'returnUrl' => $returnUrl));
     return true;
 }
コード例 #16
0
/**
 * Zikula_View function to add the contents of a block to either the header or footer multicontent page variable
 *
 * This function adds the content of the block to either the end of the <head> portion of the page (using 'header') or to
 * a position just prior to the closing </body> tag (using 'footer').
 *
 * Available parameters:
 *   - name:     The name of the page variable to set, either 'header' or 'footer'; optional, default is 'header'
 *
 * Examples:
 *
 *  This inline stylesheet will appear in the page's <head> section just before the closing </head>:
 * <code>
 *   {pageaddvarblock name='header'}
 *   <style type="text/css">
 *       p { font-size: 1.5em; }
 *   </style>
 *   {/pageaddvarblock}
 * </code>
 *
 *  This inline script will appear in the page's <body> section just before the closing </body>:
 * <code>
 *   {pageaddvarblock name='footer'}
 *   <script language="javascript" type="text/javascript">
 *       alert ('The closing </body> tag is coming.');
 *   </style>
 *   {/pageaddvarblock}
 * </code>
 *
 * @param array       $params  All attributes passed to this function from the template.
 * @param string      $content The content of the block.
 * @param Zikula_View $view    Reference to the Zikula_View object.
 *
 * @return string
 */
function smarty_block_pageaddvarblock($params, $content, Zikula_View $view)
{
    if ($content) {
        $varname = isset($params['name']) ? $params['name'] : 'header';
        if ($varname != 'header' && $varname != 'footer') {
            throw new Zikula_Exception_Fatal(__f('Invalid page variable name: \'%1$s\'.', array($varname)));
        }
        PageUtil::addVar($varname, $content);
    }
}
コード例 #17
0
ファイル: PmController.php プロジェクト: AxelPanda/ibos
 public function actionList()
 {
     $uid = Yii::app()->user->uid;
     $unreadCount = MessageContent::model()->countUnreadList($uid);
     $pageCount = MessageContent::model()->countMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT));
     $pages = PageUtil::create($pageCount);
     $list = MessageContent::model()->fetchAllMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT), $pages->getLimit(), $pages->getOffset());
     $data = array("datas" => $list, "pages" => $pages, "unreadCount" => $unreadCount);
     $this->ajaxReturn($data, "JSONP");
 }
コード例 #18
0
ファイル: DebugToolbar.php プロジェクト: projectesIF/Sirius
 /**
  * Sends an event via the EventManager to allow other code to extend the toolbar.
  *
  * @param Zikula_EventManager $eventManager Core event manager.
  */
 public function __construct(Zikula_EventManager $eventManager)
 {
     $this->eventManager = $eventManager;
     PageUtil::addVar('javascript', 'prototype');
     PageUtil::addVar('javascript', 'javascript/debugtoolbar/main.js');
     PageUtil::addVar('stylesheet', 'style/debugtoolbar.css');
     // allow modules and plugins to extend the toolbar
     $event = new Zikula_Event('debugtoolbar.init', $this);
     $this->eventManager->notify($event);
 }
コード例 #19
0
/**
 * Smarty function to provide easy access to a stylesheet.
 *
 * This function provides an easy way to include a stylesheet. The function will add the stylesheet
 * file to the 'stylesheet' pagevar by default
 *
 * This plugin is obsolete since Zikula 1.1.0. The stylesheets are loaded automatically whenever a module
 * or block is loaded. We keep this file for the sake of backwards compatibility so that themes do not break.
 *
 * @param array  $params  All attributes passed to this function from the template.
 * @param object &$smarty Reference to the Smarty object.
 *
 * @return void But Add Js header if admin
 */
function smarty_function_modulestylesheet($params, &$smarty)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('modulestylesheet')), E_USER_DEPRECATED);
    // do nothing unless we are admin
    if (SecurityUtil::checkPermission('::', '::', ACCESS_ADMIN)) {
        PageUtil::addVar('javascript', 'javascript/ajax/prototype.js');
        PageUtil::addVar('header', '<script type="text/javascript">/* <![CDATA[ */ Event.observe(window, "load", function() { alert("' . __('You can safely remove the modulestylesheet plugin from your theme. It is obsolete since Zikula 1.1.0. The adding of stylesheet files has been automated and does not need user interference. This note is shown to Administrators only.') . '");}); /* ]]> */</script>');
    }
    return;
}
コード例 #20
0
ファイル: function.title.php プロジェクト: projectesIF/Sirius
/**
 * Zikula_View function to generate the title for the page
 *
 * Available parameters:
 *  - assign     if set, the title will be assigned to this variable
 *
 * Example
 * {title}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.title.php::smarty_function_title()
 *
 * @return string The title.
 */
function smarty_function_title($params, $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('title', "pagegetvar name='title'")), E_USER_DEPRECATED);
    $title = PageUtil::getVar('title');
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $title);
    } else {
        return $title;
    }
}
コード例 #21
0
ファイル: IWWeiboComment.php プロジェクト: AxelPanda/ibos
 public function fetchCommentList()
 {
     $count = $this->getCommentCount();
     $limit = $this->getAttributes("limit");
     $pages = PageUtil::create($count, $limit);
     $this->setAttributes(array("offset" => $pages->getOffset(), "limit" => $pages->getLimit()));
     $var = array("list" => $this->getCommentList(), "lang" => Ibos::getLangSources(array("message.default")), "count" => $count, "limit" => $limit, "rowid" => $this->getAttributes("rowid"), "moduleuid" => $this->getAttributes("moduleuid"), "showlist" => $this->getAttributes("showlist"), "pages" => $pages);
     $content = $this->render("application.modules.weibo.views.comment.loadreply", $var, true);
     return $content;
 }
コード例 #22
0
ファイル: ComputerCode.php プロジェクト: robbrandt/Content
 function display()
 {
     if (ModUtil::available('BBCode') && $this->codeFilter == 'bbcode') {
         $code = '[code]' . $this->text . '[/code]';
         PageUtil::addVar('stylesheet', 'modules/BBCode/style/style.css');
         return ModUtil::apiFunc('BBCode', 'User', 'transform', array('message' => $code));
     } else {
         return $this->transformCode($this->text, true);
     }
 }
コード例 #23
0
ファイル: WebController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     $count = EmailWeb::model()->countByAttributes(array("uid" => $this->uid));
     $pages = PageUtil::create($count, $this->getListPageSize());
     $list = EmailWeb::model()->fetchByList($this->uid, $pages->getOffset(), $pages->getLimit());
     $data = array("pages" => $pages, "list" => $list);
     $this->setPageTitle(Ibos::lang("Web email"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Email center"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Web email"))));
     $this->render("index", $data);
 }
コード例 #24
0
ファイル: DebugToolbar.php プロジェクト: planetenkiller/core
 /**
  * Sends an event via the EventDispatcher to allow other code to extend the toolbar.
  *
  * @param EventDispatcher $dispatcher Core event manager.
  */
 function __construct(EventDispatcher $dispatcher)
 {
     $this->dispatcher = $dispatcher;
     \PageUtil::addVar('javascript', 'prototype');
     \PageUtil::addVar('javascript', 'javascript/debugtoolbar/main.js');
     \PageUtil::addVar('stylesheet', 'style/debugtoolbar.css');
     // allow modules and plugins to extend the toolbar
     $event = new GenericEvent($this);
     $this->dispatcher->dispatch('debugtoolbar.init', $event);
 }
コード例 #25
0
ファイル: EditPage.php プロジェクト: robbrandt/Content
 public function initialize(Zikula_Form_View $view)
 {
     $this->pageId = (int) FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : -1);
     if ((bool) $this->getVar('inheritPermissions', false) === true) {
         if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     } else {
         if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     }
     $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => true, 'filter' => array('checkActive' => false), 'enableEscape' => false, 'translate' => false, 'includeContent' => true, 'includeCategories' => true));
     if ($page === false) {
         return $this->view->registerError(null);
     }
     // load the category registry util
     $mainCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropPrimary'), 30);
     $secondCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropSecondary'));
     $multilingual = ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual');
     if ($page['language'] == ZLanguage::getLanguageCode()) {
         $multilingual = false;
     }
     PageUtil::setVar('title', $this->__("Edit page") . ' : ' . $page['title']);
     $pagelayout = ModUtil::apiFunc('Content', 'Layout', 'getLayout', array('layout' => $page['layout']));
     if ($pagelayout === false) {
         return $this->view->registerError(null);
     }
     $layouts = ModUtil::apiFunc('Content', 'Layout', 'getLayouts');
     if ($layouts === false) {
         return $this->view->registerError(null);
     }
     $layoutTemplate = $page['layoutEditTemplate'];
     $this->view->assign('layoutTemplate', $layoutTemplate);
     $this->view->assign('mainCategory', $mainCategory);
     $this->view->assign('secondCategory', $secondCategory);
     $this->view->assign('page', $page);
     $this->view->assign('multilingual', $multilingual);
     $this->view->assign('layouts', $layouts);
     $this->view->assign('pagelayout', $pagelayout);
     $this->view->assign('enableVersioning', $this->getVar('enableVersioning'));
     $this->view->assign('categoryUsage', $this->getVar('categoryUsage'));
     Content_Util::contentAddAccess($this->view, $this->pageId);
     if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
         $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
     }
     if ($this->backref != null) {
         $returnUrl = $this->backref;
     } else {
         $returnUrl = ModUtil::url('Content', 'admin', 'main');
     }
     ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentPage{$this->pageId}", 'returnUrl' => $returnUrl));
     return true;
 }
コード例 #26
0
function smarty_function_ms_greyboxheader($params, &$smarty)
{
    PageUtil::addVar('stylesheet', 'modules/mediashare/pnincludes/greybox/gb_styles.css');
    $script = '<script type="text/javascript">
                   var GB_ROOT_DIR = "' . pnGetBaseURL() . 'modules/mediashare/greybox/";
               </script>';
    PageUtil::addVar('rawtext', $script);
    PageUtil::addVar('javascript', 'modules/mediashare/pnincludes/greybox/AJS.js');
    PageUtil::addVar('javascript', 'modules/mediashare/pnincludes/greybox/AJS_fx.js');
    PageUtil::addVar('javascript', 'modules/mediashare/pnincludes/greybox/gb_scripts.js');
}
コード例 #27
0
/**
 * Zikula_View function to register a page variable
 *
 * This function registers a page-specific variable with the Zikula system.
 *
 * Available parameters:
 *   - name:     The name of the page variable to obtain
 *
 * Zikula doesn't impose any restriction on the page variable's name except for duplicate
 * and reserved names. As of this writing, the list of reserved names consists of
 * <ul>
 * <li>title</li>
 * <li>description</li>
 * <li>keywords</li>
 * <li>stylesheet</li>
 * <li>javascript</li>
 * <li>body</li>
 * <li>header</li>
 * <li>footer</li>
 * </ul>
 *
 * In addition, if your system is operating in legacy compatibility mode, then
 * the variable 'rawtext' is reserved, and maps to 'header'. (When not operating in
 * legacy compatibility mode, 'rawtext' is not reserved and will not be rendered
 * to the page output by the page variable output filter.)
 *
 * Example
 *   {pageregistervar name='title'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The module variable.
 */
function smarty_function_pageregistervar($params, Zikula_View $view)
{
    $name = isset($params['name']) ? $params['name'] : null;
    $multivalue = isset($params['multivalue']) ? $params['multivalue'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    if (!$name) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pnpageregistervar', 'name')));
        return false;
    }
    PageUtil::registerVar($name, $multivalue, $default);
    return;
}
コード例 #28
0
ファイル: IWWfListView.php プロジェクト: AxelPanda/ibos
 protected function setPages()
 {
     $dataReader = Ibos::app()->db->createCommand()->select("count(*)")->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($this->getCondition())->group($this->getQueryGroup())->query();
     $count = $dataReader->count();
     $pages = PageUtil::create($count, $this->getPageSize());
     if ($this->getKeyword() != "" && $count) {
         $pages->params = array("keyword" => $this->getKeyword());
     }
     $this->setOffset($pages->getOffset());
     $this->setLimit($pages->getLimit());
     $this->_var["pages"] = $pages;
 }
コード例 #29
0
ファイル: PmController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     $uid = Yii::app()->user->uid;
     MessageUser::model()->setMessageIsRead($uid, EnvUtil::getRequest("id"), 1);
     $unreadCount = MessageContent::model()->countUnreadList($uid);
     $pageCount = MessageContent::model()->countMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT));
     $pages = PageUtil::create($pageCount);
     $list = MessageContent::model()->fetchAllMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT), $pages->getLimit(), $pages->getOffset());
     $data = array("list" => $list, "pages" => $pages, "unreadCount" => $unreadCount);
     $this->setPageTitle(Ibos::lang("PM"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("PM"))));
     $this->render("index", $data);
 }
コード例 #30
0
ファイル: NotifyController.php プロジェクト: AxelPanda/ibos
 public function actionDetail()
 {
     $uid = Yii::app()->user->uid;
     $module = EnvUtil::getRequest("module");
     $pageCount = Yii::app()->db->createCommand()->select("count(id)")->from("{{notify_message}}")->where("uid={$uid} AND module = '{$module}'")->group("module")->queryScalar();
     $pages = PageUtil::create($pageCount);
     $list = NotifyMessage::model()->fetchAllDetailByTimeLine($uid, $module, $pages->getLimit(), $pages->getOffset());
     $data = array("list" => $list, "pages" => $pages);
     NotifyMessage::model()->setReadByModule($uid, $module);
     $this->setPageTitle(Ibos::lang("Detail notify"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Notify"), "url" => $this->createUrl("notify/index")), array("name" => Ibos::lang("Detail notify"))));
     $this->render("detail", $data);
 }