当前位置: 首页>>代码示例>>PHP>>正文


PHP Widgets::isInstalled方法代码示例

本文整理汇总了PHP中Widgets::isInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP Widgets::isInstalled方法的具体用法?PHP Widgets::isInstalled怎么用?PHP Widgets::isInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Widgets的用法示例。


在下文中一共展示了Widgets::isInstalled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * The index action is the default action of this Wall Module. It prepares the widget
  * wall of the user and render the view according to its preferences.
  *
  * If the current user is not authenticated, it will be redirected to the users/index
  * action that will allows you to acces the login form of the application.
  *
  */
 public function index($continuePurchase = false, $langage = null, $forcebrowser = false)
 {
     # Try to force users to use firefox
     //		if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){
     //			$forcebrowser = true;
     //		}
     //		if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){
     //			require(DefaultFC::getView('compatibility.tpl'));
     //			die();
     //		}else{
     //			$_SESSION['forcebrowser'] = true;
     //		}
     if (Auth::isAuth()) {
         // Determine if the 'category widget' is installed.
         if (Widgets::isInstalled('categoryList')) {
             $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories');
         }
         // Determine if the 'tag cloud widget' is installed.
         if (Widgets::isInstalled('tagCloud')) {
             $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud');
         }
         // Determine if the view must allow the user to manage widgets.
         $widgetManagement = false;
         if (Auth::isAdmin() || Auth::isGod()) {
             $widgetManagement = true;
         }
         // Determine if the view must show the list of installed widgets or
         // a link to the PALETTE Service Browser.
         $useServiceBrowser = USE_SERVICE_BROWSER;
         $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null;
         require DefaultFC::getView('index.tpl');
     } else {
         DefaultFC::redirection('users/index?ref=wall');
     }
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:43,代码来源:Wall.class.php

示例2: retrieveAvalaibleLanguage

 /**
  * This function return the available langages according to the "locales" folder of
  * a installer widget.
  */
 public static function retrieveAvalaibleLanguage($widgetId)
 {
     $availableLanguage = array();
     # First get the code of languages
     if (Widgets::isInstalled($widgetId)) {
         # TODO verify that widgetId is the name of the locales folder of widget...
         $pathToWidget = dirname(__FILE__) . '/../widgets/' . $widgetId . '/locales/';
         if (is_dir($pathToWidget)) {
             if ($root = opendir($pathToWidget)) {
                 while (false !== ($file = readdir($root))) {
                     if (ereg('^[a-z\\-]+$', $file)) {
                         $availableLanguage[$file] = $file;
                     }
                 }
             }
         }
     }
     # Second, try to determine the language name
     if (isset($GLOBALS['l10n_catalogue'])) {
         // Come from /includes/l10n_catalogue.php
         reset($availableLanguage);
         $tmp = array();
         foreach ($availableLanguage as $code => $label) {
             # If the code exists in l10n catalogue get the name of the language
             if (isset($GLOBALS['l10n_catalogue'][$code])) {
                 $tmp[$code] = $GLOBALS['l10n_catalogue'][$code]['language'];
             } else {
                 $tmp[$code] = $label;
             }
         }
         $availableLanguage = $tmp;
     }
     asort($availableLanguage);
     return $availableLanguage;
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:39,代码来源:Widgets.class.php

示例3: subscribe

 /**
  * Makes effective a subscribing to a given widget for a particular user in the database. If
  * the widget already exists in the user's UI, the call to this function will simply
  * be ignored.
  *
  * You have to know that if the widget is inserted in the user's UI, it will take place
  * in the first column of the screen, at the first place (in other words: top-left on the screen).
  *
  * @param integer $userId The user's identifier in the database
  * @param string $widgetId The widget's identifier to wich the user want to subscribe.
  */
 public static function subscribe($userId, $widgetId)
 {
     // Test if the widget exists. Developpers please be carefull, there's a dependancy on /models/Widgets::isInstalled.
     if (!Widgets::isInstalled($widgetId)) {
         throw new ServiceException(MwwException::MODEL, "Unable to subscribe user '{$userId}' to widget '{$widgetId}'. The widget is not installed.");
     }
     // Sanitization and database connexion.
     $db = DbUtil::accessFactory();
     $userId = $db->escape($userId);
     $widgetId = $db->escape($widgetId);
     // Test if the widget needs to be added to the user interface.
     # $rs = $db->select("SELECT * FROM interface as i, widget_instances as wi WHERE userid = ${userId} AND wi.instanceid = i.widgetinstanceid AND wi.widgetid = '${widgetId}'");
     # TODO Remove this ligne because in case of multi instanciation there is not this constrain
     //if($rs->isEmpty())
     //{
     // We can subscribe this user to the requested widget.
     // Developpers note : be careful the 'column' mysql keyword use in the following queries. Use brackets !
     # New instance
     $db->execute("INSERT INTO `widget_instances` (`widgetid`) VALUES ('" . $widgetId . "')");
     $widgetInstanceId = mysql_insert_id();
     # TODO test this, may be do a transaction and use clearbricks
     $db->execute("UPDATE interface SET position = position + 1 WHERE userid = {$userId} AND `column` = 0");
     $db->execute("INSERT INTO interface (userid, widgetinstanceid, `column`, minimized, position) VALUES ({$userId}, '{$widgetInstanceId}', '0', '0', '0')");
     //}
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:36,代码来源:UserInterface.class.php


注:本文中的Widgets::isInstalled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。