public function displayWidgets($containerNumber) { $widgetLayoutName = $this->getWidgetLayoutName(); $layout = $this->model->{$widgetLayoutName}; foreach ($layout as $widgetClass => $settings) { if ($settings['containerNumber'] == $containerNumber) { SortableWidget::instantiateWidget($widgetClass, $this->model); } } }
public function run() { if ($this->widgetManager->layoutManager->staticLayout) { return; } // hide widget if journal view is disabled if (!Yii::app()->params->profile->miscLayoutSettings['enableJournalView']) { $this->registerSharedCss(); $this->render('application.components.sortableWidget.views.' . $this->sharedViewFile, array('widgetClass' => get_called_class(), 'profile' => $this->profile, 'hidden' => true, 'widgetUID' => $this->widgetUID)); return; } parent::run(); }
public function displayWidgets() { if ($this->report) { $profile = $this->report; } else { $profile = Yii::app()->params->profile; } $layout = $profile->dataWidgetLayout; // display profile widgets in order foreach ($layout as $widgetLayoutKey => $settings) { if ($this->filterReport($settings['chartId'])) { // $force = isset($this->report); SortableWidget::instantiateWidget($widgetLayoutKey, $profile, 'data'); } } }
protected function getCss() { if (!isset($this->_css)) { $this->_css = array_merge(parent::getCss(), array('inlineTagsWidgetCSS' => "\n #x2-tags-container {\n padding: 7px;\n }\n ")); } return $this->_css; }
/** * Instantiates the widget * @param string $widgetLayoutKey Key in widget layout associative array. Contains the widget * class name as well as the uid * @param object profile */ public static function instantiateWidget($widgetLayoutKey, $profile, $widgetType = 'profile', $options = array()) { list($widgetClass, $widgetUID) = SortableWidget::parseWidgetLayoutKey($widgetLayoutKey); if ($widgetClass::getJSONProperty($profile, 'softDeleted', $widgetType, $widgetUID)) { return; } return Yii::app()->controller->widget('application.components.sortableWidget.' . $widgetClass, array_merge(array('widgetUID' => $widgetUID, 'profile' => $profile, 'widgetType' => $widgetType), $options)); }
/** * overrides parent method. Returns chart specific css */ protected function getCss() { if (!isset($this->_css)) { $this->_css = array_merge(parent::getCss(), array('sortableWidgetChartCss' => "\n .sortable-widget-container .chart-subtype-selector {\n\t margin: 1px 0px 4px 5px;\n border: 1px solid #ddd;\n }\n\n .sortable-widget-container div.chart-container {\n -moz-border-radius: 0px !important;\n -o-border-radius: 0px !important;\n -webkit-border-radius: 0px !important;\n border-radius: 0px !important;\n }\n\n .sortable-chart-widget .chart-controls-container {\n width: 604px;\n padding: 3px;\n }\n\n .sortable-chart-widget .chart-widget-button-container .relabel-widget-button {\n margin-right: 5px;\n }\n\n @media (max-width: 684px) {\n .sortable-chart-widget .chart-controls-container {\n width: 95%;\n padding: 3px;\n }\n .sortable-chart-widget .popup-dropdown-menu.flipped:before {\n right: 52px;\n }\n .sortable-chart-widget .popup-dropdown-menu {\n left: 0 !important;\n right: 0!important;\n margin: auto;\n }\n }\n\n @media (max-width: 529px) {\n .sortable-chart-widget .chart-container .bin-size-button-set {\n margin-top: 6px;\n }\n }\n\n /* menu contents */\n @media (max-width: 500px) {\n .sortable-chart-widget .chart-container .chart-filters-container {\n height: auto;\n }\n .sortable-chart-widget .ui-multiselect {\n margin-top: 0 !important;\n }\n }\n ")); } return $this->_css; }
echo CHtml::link('<span class="fa fa-edit fa-lg"></span>', $this->createUrl('update', array('id' => $model->id)), array('class' => 'edit right', 'title' => Yii::t('app', 'Edit Profile'))); ?> </div> <?php // echo $model->getHiddenProfileWidgetMenu (); } ?> </div> <!-- <div id='create-profile-widget-dialog' class='form' style='display: none;'> <label for='' class='left-label'><?php echo Yii::t('app', 'Widget Type: '); ?> </label> <?php $widgetSubtypeOptions = SortableWidget::getWidgetSubtypeOptions('profile'); asort($widgetSubtypeOptions); // $widgetSubtypeOptions['ChartWidget'] = "Chart Widget"; echo CHtml::dropDownList('widgetType', '', $widgetSubtypeOptions); ?> </div> --> <div id='profile-info-contents-container' <?php echo $isMyProfile && $profileInfoMinimized ? 'style="display: none;"' : ''; ?> > <table id='profile-info' class="details"> <tr> <td class="label" width="20%"><?php echo $attributeLabels['fullName'];
protected static function createWidget($layoutKey, $profile, $widgetType = 'profile', $options = array()) { list($widgetClass, $widgetUID) = SortableWidget::parseWidgetLayoutKey($layoutKey); return Yii::app()->controller->createWidget('application.components.sortableWidget.' . $widgetClass, array_merge(array('widgetUID' => $widgetUID, 'profile' => $profile, 'widgetType' => $widgetType), $options)); }
protected function getCss() { if (!isset($this->_css)) { $this->_css = array_merge(parent::getCss(), array('WorkflowStageDetailsWidgetCSS' => "\n\n #workflowSelector {\n margin-left: 13px;\n }\n\n #funnel-container {\n position: relative;\n width: auto;\n margin-left: 12px;\n margin-top: 9px;\n max-width: 500px;\n }\n\n #funnel-container .interaction-buttons > a {\n margin-right: 3px;\n display: inline-block;\n vertical-align: middle;\n text-decoration: none;\n }\n\n #funnel-container .interaction-buttons {\n height: 17px;\n }\n\n\n #funnel-container img {\n margin-right: 4px;\n opacity: 0.8;\n }\n\n #funnel-container img:hover {\n opacity: 1;\n }\n\n div.workflow-status {\n overflow: hidden;\n display: block;\n line-height: 20px;\n height: 24px;\n max-width: 340px;\n margin-right: 10px;\n }\n\n div.workflow-status b {\n float: left;\n }\n\n div.workflow-status a {\n float: right;\n }\n ")); } return $this->_css; }
/** * Called to retieve widget contents * Expected POST data: * widgetClass - the name of the widget class * Echoes: * 'failure' if the request action fails, an HTML string containing the widget contents * otherwise */ public function actionShowWidgetContents() { if (!isset($_POST['widgetClass']) || !isset($_POST['widgetType'])) { echo 'failure'; return; } if (isset($_POST['widgetType']) === 'recordView' && (!isset($_POST['modelId']) || !isset($_POST['modelType']))) { echo 'failure'; return; } $profile = self::getModelFromPost(); $widgetKey = $_POST['widgetClass']; $widgetType = $_POST['widgetType']; list($widgetClass, $widgetUID) = SortableWidget::parseWidgetLayoutKey($widgetKey); if ($profile && class_exists($widgetClass)) { if ($widgetClass::setJSONProperty($profile, 'hidden', 0, $widgetType, $widgetUID)) { if ($widgetType === 'recordView') { $model = X2Model::getModelOfTypeWithId($_POST['modelType'], $_POST['modelId']); if ($model !== null) { echo $widgetClass::getWidgetContents($this, $profile, $widgetType, $widgetUID, array('model' => $model)); } } else { echo $widgetClass::getWidgetContents($this, $profile, $widgetType, $widgetUID); } return; } } echo 'failure'; return; }
/** * Default landing page action for the web application. * * Displays a feed of new records that have been created since the last * login of the current web user. */ public function actionView($id, $publicProfile = false) { if (isset($_GET['ajax'])) { // ajax request from grid view widget if (!isset($_POST['widgetClass']) && !isset($_POST['widgetType'])) { $_POST['widgetClass'] = $_GET['ajax']; $_POST['widgetType'] = $_GET['widgetType']; } if (SortableWidget::getParentType($_POST['widgetType']) === 'recordView') { $_POST['modelId'] = $_GET['modelId']; $_POST['modelType'] = $_GET['modelType']; } $this->actionShowWidgetContents(); return; } if (isset($_GET['widgetClass']) && isset($_GET['widgetType']) && SortableWidget::getParentType($_GET['widgetType']) === 'recordView' && isset($_GET['modelId']) && isset($_GET['modelType'])) { $_POST['widgetClass'] = $_GET['widgetClass']; $_POST['widgetType'] = $_GET['widgetType']; $_POST['modelId'] = $_GET['modelId']; $_POST['modelType'] = $_GET['modelType']; $this->actionShowWidgetContents(); return; } if (isset($_GET['widgetClass']) && isset($_GET['widgetType'])) { $_POST['widgetClass'] = $_GET['widgetClass']; $_POST['widgetType'] = $_GET['widgetType']; $this->actionShowWidgetContents(); return; } if (!Yii::app()->user->isGuest) { $activityFeedParams = $this->getActivityFeedViewParams($id, $publicProfile); $params = array('activityFeedParams' => $activityFeedParams, 'isMyProfile' => $activityFeedParams['isMyProfile'], 'model' => $activityFeedParams['model']); $this->render('profile', $params); } else { $this->redirectToLogin(); } }
public function displayWidgets($containerNumber) { $widgetLayoutName = $this->widgetLayoutName; $layout = Yii::app()->params->profile->{$widgetLayoutName}; foreach ($layout as $widgetClass => $settings) { if ($this->isExcluded($widgetClass)) { continue; } if ($settings['containerNumber'] == $containerNumber) { if (isset($this->widgetParamsByWidgetName[$widgetClass])) { $options = $this->widgetParamsByWidgetName[$widgetClass]; } else { $options = array(); } $options = array_merge(array('model' => $this->model, 'widgetManager' => $this), $options); SortableWidget::instantiateWidget($widgetClass, Yii::app()->params->profile, 'recordView', $options); } } }
protected function getJSSortableWidgetParams() { if (!isset($this->_JSSortableWidgetParams)) { if (!$this->hasError()) { $lastTweetId = $this->getLastTweetId(); } else { $lastTweetId = null; } $this->_JSSortableWidgetParams = array_merge(parent::getJSSortableWidgetParams(), array('lastTweetId' => $lastTweetId)); } return $this->_JSSortableWidgetParams; }
public function init($skipGridViewInit = false) { parent::init(); if (!$skipGridViewInit) { list($updateRoute, $updateParams) = $this->getAjaxUpdateRouteAndParams(); $this->dataProvider->pagination->route = $updateRoute; $this->dataProvider->pagination->params = $updateParams; $this->dataProvider->sort->route = $updateRoute; $this->dataProvider->sort->params = $updateParams; } }
protected function getSettingsMenuContentDialogs() { return '<div id="select-a-document-dialog-' . $this->widgetUID . '" style="display: none;">' . '<div>' . Yii::t('profile', 'Enter the name of a {Doc}:', array('{Doc}' => Modules::displayName(false, 'Docs'))) . '</div>' . '<input class="selected-doc">' . '</div>' . parent::getSettingsMenuContentDialogs(); }
/** * Magic getter. Returns this widget's css * @return array key is the proposed name of the css string which should be passed as the first * argument to yii's registerCss. The value is the css string. */ protected function getCss() { if (!isset($this->_css)) { $this->_css = array_merge(parent::getCss(), array('iframeWidgetCss' => "\n #" . get_called_class() . "-widget-content-container {\n padding-bottom: 1px;\n }\n\n .change-url-dialog p {\n display: inline;\n margin-right: 5px;\n }\n\n .default-text-container {\n text-align: center;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n .default-text-container a {\n height: 17%;\n text-decoration: none;\n font-size: 16px;\n margin: auto;\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n }\n ")); } return $this->_css; }
/** * Delete a default widget and ensure that it can be recreated */ public function testDefaultWidgetRecreation() { $profile = $this->profiles('adminProfile'); $widgetSubtype = 'ContactsGridViewProfileWidget'; $success = SortableWidget::deleteSortableWidget($profile, $widgetSubtype, '', 'profile'); $this->assertTrue($success); $widgetLayoutBefore = $profile->profileWidgetLayout; $widgetSettings = $widgetLayoutBefore[$widgetSubtype]; $this->assertTrue($widgetSettings['softDeleted']); list($success, $uid) = SortableWidget::createSortableWidget($profile, $widgetSubtype, 'profile'); $this->assertTrue($success); $widgetLayoutAfter = $profile->profileWidgetLayout; $widgetSettings = $widgetLayoutAfter[$widgetSubtype]; $this->assertFalse($widgetSettings['softDeleted']); $this->assertEquals(array_keys($widgetLayoutBefore), array_keys($widgetLayoutAfter)); }