Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • None
  • system
    • base
    • caching
    • console
    • db
      • ar
      • schema
    • validators
    • web
      • actions
      • auth
      • helpers
      • widgets
        • captcha
        • pagers
  • zii
    • widgets
      • grid

Classes

  • AccountsGridViewProfileWidget
  • ActionMenu
  • ActionsGridViewProfileWidget
  • ActionsQuickCreateRelationshipBehavior
  • ActiveDateRangeInput
  • ApplicationConfigBehavior
  • Attachments
  • ChatBox
  • CommonControllerBehavior
  • ContactMapInlineTags
  • ContactsGridViewProfileWidget
  • CronForm
  • CSaveRelationsBehavior
  • DateRangeInputsWidget
  • DocsGridViewProfileWidget
  • DocViewer
  • DocViewerProfileWidget
  • EButtonColumnWithClearFilters
  • EmailDeliveryBehavior
  • EmailProgressControl
  • EncryptedFieldsBehavior
  • EventsChartProfileWidget
  • FileUploader
  • FontPickerInput
  • Formatter
  • FormView
  • GridViewWidget
  • History
  • IframeWidget
  • ImportExportBehavior
  • InlineActionForm
  • InlineEmailAction
  • InlineEmailForm
  • InlineEmailModelBehavior
  • InlineQuotes
  • JSONEmbeddedModelFieldsBehavior
  • JSONFieldsDefaultValuesBehavior
  • LeadRoutingBehavior
  • LeftWidget
  • LoginThemeHelper
  • LoginThemeHelperBase
  • MarketingGridViewProfileWidget
  • MediaBox
  • MessageBox
  • MobileFormatter
  • MobileFormLayoutRenderer
  • MobileLayoutRenderer
  • MobileLoginThemeHelper
  • MobileViewLayoutRenderer
  • ModelFileUploader
  • NewWebLeadsGridViewProfileWidget
  • NormalizedJSONFieldsBehavior
  • NoteBox
  • OnlineUsers
  • OpportunitiesGridViewProfileWidget
  • Panel
  • ProfileDashboardManager
  • ProfileGridViewWidget
  • ProfileLayoutEditor
  • ProfilesGridViewProfileWidget
  • Publisher
  • PublisherActionTab
  • PublisherCalendarEventTab
  • PublisherCallTab
  • PublisherCommentTab
  • PublisherEventTab
  • PublisherSmallCalendarEventTab
  • PublisherTab
  • PublisherTimeTab
  • QuickContact
  • QuickCreateRelationshipBehavior
  • QuotesGridViewProfileWidget
  • RecordAliasesWidget
  • RecordViewLayoutManager
  • RecordViewWidgetManager
  • RememberPagination
  • Reminders
  • ResponseBehavior
  • ResponsiveHtml
  • SearchIndexBehavior
  • ServicesGridViewProfileWidget
  • SmallCalendar
  • SmartActiveDataProvider
  • SmartDataProviderBehavior
  • SmartSort
  • SocialForm
  • SortableWidgetManager
  • SortableWidgets
  • TagBehavior
  • TagCloud
  • TemplatesGridViewProfileWidget
  • TimeZone
  • TopContacts
  • TopSites
  • TransformedFieldStorageBehavior
  • TranslationLogger
  • TwitterFeed
  • TwoColumnSortableWidgetManager
  • UpdaterBehavior
  • UpdatesForm
  • UserIdentity
  • UsersChartProfileWidget
  • WorkflowBehavior
  • X2ActiveGridView
  • X2ActiveGridViewForSortableWidgets
  • X2AssetManager
  • X2AuthManager
  • X2ChangeLogBehavior
  • X2ClientScript
  • X2Color
  • X2DateUtil
  • X2FixtureManager
  • X2FlowFormatter
  • X2GridView
  • X2GridViewBase
  • X2GridViewForSortableWidgets
  • X2GridViewSortableWidgetsBehavior
  • X2LeadsGridViewProfileWidget
  • X2LinkableBehavior
  • X2ListView
  • X2PillBox
  • X2ProgressBar
  • X2SmartSearchModelBehavior
  • X2TimestampBehavior
  • X2TranslationBehavior
  • X2UrlRule
  • X2WebModule
  • X2Widget
  • X2WidgetList
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /*****************************************************************************************
  3:  * X2Engine Open Source Edition is a customer relationship management program developed by
  4:  * X2Engine, Inc. Copyright (C) 2011-2016 X2Engine Inc.
  5:  * 
  6:  * This program is free software; you can redistribute it and/or modify it under
  7:  * the terms of the GNU Affero General Public License version 3 as published by the
  8:  * Free Software Foundation with the addition of the following permission added
  9:  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 10:  * IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
 11:  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 12:  * 
 13:  * This program is distributed in the hope that it will be useful, but WITHOUT
 14:  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 15:  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 16:  * details.
 17:  * 
 18:  * You should have received a copy of the GNU Affero General Public License along with
 19:  * this program; if not, see http://www.gnu.org/licenses or write to the Free
 20:  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 21:  * 02110-1301 USA.
 22:  * 
 23:  * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 24:  * California 95067, USA. or at email address contact@x2engine.com.
 25:  * 
 26:  * The interactive user interfaces in modified source and object code versions
 27:  * of this program must display Appropriate Legal Notices, as required under
 28:  * Section 5 of the GNU Affero General Public License version 3.
 29:  * 
 30:  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 31:  * these Appropriate Legal Notices must retain the display of the "Powered by
 32:  * X2Engine" logo. If the display of the logo is not reasonably feasible for
 33:  * technical reasons, the Appropriate Legal Notices must display the words
 34:  * "Powered by X2Engine".
 35:  *****************************************************************************************/
 36: 
 37: Yii::import ('application.modules.mobile.components.panel.*');
 38: Yii::import ('application.modules.mobile.components.*');
 39: 
 40: class Panel extends X2Widget {
 41: 
 42:     private $_packages;
 43:     public function getPackages () {
 44:         if (!isset ($this->_packages)) {
 45:             $this->_packages = array_merge (parent::getPackages (), array (
 46:                 'PanelJS' => array(
 47:                     'baseUrl' => Yii::app()->controller->assetsUrl,
 48:                     'js' => array(
 49:                         'js/Panel.js',
 50:                     ),
 51:                 ),
 52:             ));
 53:         }
 54:         return $this->_packages;
 55:     }
 56: 
 57:     public function getModuleItems () {
 58:         $modules = MobileModule::supportedModules ();
 59:         $modules = array_filter ($modules, function ($module) {
 60:             if ($module->name === 'users') {
 61:                 $action = 'ProfileMobileIndex';
 62:             } else {
 63:                 $action = ucfirst ($module->name).'Index';
 64:             }
 65:             $authItem = Yii::app()->authManager->getAuthItem ($action);
 66:             return Yii::app()->params->isAdmin || 
 67:                 is_null ($authItem) || Yii::app()->user->checkAccess ($action);
 68:         });
 69:         return array_map (function ($module) {
 70:             $item = new ModulePanelItem;
 71:             $item->module = $module;
 72:             return $item;
 73:         }, $modules);
 74:     }
 75: 
 76:     public function getRecentItems ($pageSize=1) {
 77:         $dataProvider = MobileRecentItems::getDataProvider ($pageSize);
 78:         $data = array_map (function ($record) {
 79:             $item = new RecentItemPanelItem;
 80:             $item->model = $record['model'];
 81:             return $item;
 82:         }, $dataProvider->getData ());
 83:         if (count ($data) < count (MobileRecentItems::getRecentItems ())) {
 84:             $item = new RecentItemPanelItem;
 85:             $item->model = 'more';
 86:             $data[] = $item;
 87:         }
 88:         return $data;
 89:     }
 90: 
 91:     public function getPages () {
 92:         return array (
 93:             'modules' => $this->getModuleItems (),
 94:             'recentItems' => $this->getRecentItems (),
 95:             'auxiliary' => array (
 96:                 Yii::createComponent (array (
 97:                     'class' => 'PanelItem',
 98:                     'title' => Yii::t('app', 'Settings'),
 99:                     'id' => 'settings',
100:                     'isSelected' => preg_match (
101:                         '/mobile\/settings$/', Yii::app()->request->pathInfo),
102:                     'href' => Yii::app()->createAbsoluteUrl ('/mobile/settings'),
103:                 )),
104:                 Yii::createComponent (array (
105:                     'class' => 'PanelItem',
106:                     'title' => Yii::t('app', 'About'),
107:                     'id' => 'about',
108:                     'isSelected' => preg_match ('/mobile\/about$/', Yii::app()->request->pathInfo),
109:                     'href' => Yii::app()->createAbsoluteUrl ('/mobile/about'),
110:                 )),
111:                 Yii::createComponent (array (
112:                     'class' => 'PanelItem',
113:                     'title' => Yii::t('app', 'Log Out'),
114:                     //'linkHtmlOptions' => array (
115:                         //'rel' => 'external',
116:                     //),
117:                     'href' => Yii::app()->createAbsoluteUrl ('/mobile/logout'),
118:                     'id' => 'logOut',
119:                     'linkHtmlOptions' => array (
120:                         'class' => 'logout-button'
121:                     )
122:                 )),
123:             )
124:         );
125:     }
126: 
127:     public function renderSectionTitle ($section) {
128:         $html = '';
129:         switch ($section) {
130:             case 'modules':
131:                 break;
132:             case 'auxiliary':
133:                 $html .= "<li data-role='list-divider'></li>";
134:                 break;
135:             case 'recentItems':
136:                 $html .= 
137:                     "<li data-role='list-divider'  
138:                       class='panel-recent-item ui-li-divider ui-bar-inherit'>".
139:                         CHtml::encode (Yii::t('app', 'RECENT')). 
140:                     "</li>";
141:                 break;
142:         }
143:         return $html;
144:     }
145: 
146:     public function renderItems ($filter=null) {
147:         $pages = $this->getPages ();
148:         if ($filter) {
149:             $sections = array_filter (array_keys ($pages), $filter);
150:             $pages = array_intersect_key ($pages, array_flip ($sections));
151:         }
152: 
153:         $html = '';
154:         foreach ($pages as $section => $items) {
155:             $html .= $this->renderSectionTitle ($section);
156:             foreach ($items as $item) {
157:                 $html .= $item->render ();
158:             }
159:         }
160:         return $html;
161:     }
162: 
163:     public function run () {
164:         parent::run ();
165:         $this->registerPackages (); 
166:         $this->render ('application.modules.mobile.views.mobile._panel');
167:     }
168: 
169: }
170: 
171: ?>
172: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0