public function renderDate($field, array $htmlOptions = array()) { $model = $this->owner; $fieldName = $field->fieldName; $oldDateVal = $model->{$fieldName}; $model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium'); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => false); if (Yii::app()->getLanguage() === 'fr') { $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames(); } $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'date', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel, 'class' => 'x2-mobile-datepicker'), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true); $model->{$fieldName} = $oldDateVal; return $input; }
public static function renderModelInput(CModel $model, $field, $htmlOptions = array()) { if (!$field->asa('CommonFieldsBehavior')) { throw new Exception('$field must have CommonFieldsBehavior'); } if ($field->required) { if (isset($htmlOptions['class'])) { $htmlOptions['class'] .= ' x2-required'; } else { $htmlOptions = array_merge(array('class' => 'x2-required'), $htmlOptions); } } $fieldName = $field->fieldName; if (!isset($field)) { return null; } switch ($field->type) { case 'text': return CHtml::activeTextArea($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), array_merge(array('encode' => false), $htmlOptions))); case 'date': $oldDateVal = $model->{$fieldName}; $model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium'); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => true); if (Yii::app()->getLanguage() === 'fr') { $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames(); } $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'date', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true); $model->{$fieldName} = $oldDateVal; return $input; case 'dateTime': $oldDateTimeVal = $model->{$fieldName}; $pickerOptions = array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => true, 'changeYear' => true); if (Yii::app()->getLanguage() === 'fr') { $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames(); } $model->{$fieldName} = Formatter::formatDateTime($model->{$fieldName}); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'datetime', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true); $model->{$fieldName} = $oldDateTimeVal; return $input; case 'dropdown': // Note: if desired to translate dropdown options, change the seecond argument to // $model->module $om = $field->getDropdownOptions(); $multi = (bool) $om['multi']; $dropdowns = $om['options']; $curVal = $multi ? CJSON::decode($model->{$field->fieldName}) : $model->{$field->fieldName}; $ajaxArray = array(); if ($field instanceof Fields) { $dependencyCount = X2Model::model('Dropdowns')->countByAttributes(array('parent' => $field->linkType)); $fieldDependencyCount = X2Model::model('Fields')->countByAttributes(array('modelName' => $field->modelName, 'type' => 'dependentDropdown', 'linkType' => $field->linkType)); if ($dependencyCount > 0 && $fieldDependencyCount > 0) { $ajaxArray = array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{ "val":$(this).val(), "dropdownId":"' . $field->linkType . '", "field":true, "module":"' . $field->modelName . '" }', 'success' => ' function(data){ if(data){ data=JSON.parse(data); if(data[0] && data[1]){ $("#' . $field->modelName . '_"+data[0]).html(data[1]); } } }')); } } $htmlOptions = array_merge($htmlOptions, $ajaxArray, array('title' => $field->attributeLabel)); if ($multi) { $multiSelectOptions = array(); if (!is_array($curVal)) { $curVal = array(); } foreach ($curVal as $option) { $multiSelectOptions[$option] = array('selected' => 'selected'); } $htmlOptions = array_merge($htmlOptions, array('options' => $multiSelectOptions, 'multiple' => 'multiple')); } elseif ($field->includeEmpty) { $htmlOptions = array_merge($htmlOptions, array('empty' => Yii::t('app', "Select an option"))); } return CHtml::activeDropDownList($model, $field->fieldName, $dropdowns, $htmlOptions); case 'dependentDropdown': return CHtml::activeDropDownList($model, $field->fieldName, array('' => '-'), array_merge(array('title' => $field->attributeLabel), $htmlOptions)); case 'link': $linkSource = null; $linkId = ''; $name = ''; if (class_exists($field->linkType)) { // Create a model for autocompletion: if (!empty($model->{$fieldName})) { list($name, $linkId) = Fields::nameAndId($model->{$fieldName}); $linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true); } else { $linkModel = X2Model::model($field->linkType); } if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) { $linkSource = Yii::app()->controller->createUrl($linkModel->autoCompleteSource); $linkId = $linkModel->id; $oldLinkFieldVal = $model->{$fieldName}; $model->{$fieldName} = $name; } } static $linkInputCounter = 0; $hiddenInputId = $field->modelName . '_' . $fieldName . "_id" . $linkInputCounter++; $input = CHtml::hiddenField($field->modelName . '[' . $fieldName . '_id]', $linkId, array('id' => $hiddenInputId)) . Yii::app()->controller->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => $model, 'attribute' => $fieldName, 'source' => $linkSource, 'value' => $name, 'options' => array('minLength' => '1', 'select' => 'js:function( event, ui ) { $("#' . $hiddenInputId . '"). val(ui.item.id); $(this).val(ui.item.value); return false; }', 'create' => $field->linkType == 'Contacts' ? 'js:function(event, ui) { $(this).data( "uiAutocomplete" )._renderItem = function(ul,item) { return $("<li>").data("item.autocomplete",item). append(x2.forms.renderContactLookup(item)). appendTo(ul); }; }' : ($field->linkType == 'BugReports' ? 'js:function(event, ui) { $(this).data( "uiAutocomplete" )._renderItem = function( ul, item ) { var label = "<a style=\\"line-height: 1;\\">" + item.label; label += "<span style=\\"font-size: 0.6em;\\">"; // add email if defined if(item.subject) { label += "<br>"; label += item.subject; } label += "</span>"; label += "</a>"; return $( "<li>" ) .data( "item.autocomplete", item ) .append( label ) .appendTo( ul ); }; }' : '')), 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions)), true); if (isset($oldLinkFieldVal)) { $model->{$fieldName} = $oldLinkFieldVal; } return $input; case 'rating': return Yii::app()->controller->widget('X2StarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => isset($htmlOptions['disabled']) && $htmlOptions['disabled'], 'minRating' => Fields::RATING_MIN, 'maxRating' => Fields::RATING_MAX, 'starCount' => Fields::RATING_MAX - Fields::RATING_MIN + 1, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css', 'htmlOptions' => $htmlOptions, 'callback' => 'function(value, link){ if (typeof x2 !== "undefined" && typeof x2.InlineEditor !== "undefined" && typeof x2.InlineEditor.ratingFields !== "undefined") { x2.InlineEditor.ratingFields["' . $field->modelName . '[' . $field->fieldName . ']"] = value; } }'), true); case 'boolean': $checkbox = CHtml::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'checkboxWrapper'))); $checkbox .= CHtml::activeCheckBox($model, $field->fieldName, array_merge(array('unchecked' => 0, 'title' => $field->attributeLabel), $htmlOptions)); $checkbox .= CHtml::closeTag('div'); return $checkbox; case 'assignment': $oldAssignmentVal = $model->{$fieldName}; $model->{$fieldName} = !empty($model->{$fieldName}) ? $field->linkType == 'multiple' && !is_array($model->{$fieldName}) ? explode(', ', $model->{$fieldName}) : $model->{$fieldName} : X2Model::getDefaultAssignment(); $dropdownList = CHtml::activeDropDownList($model, $fieldName, X2Model::getAssignmentOptions(true, true), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . '_' . $fieldName . '_assignedToDropdown', 'multiple' => $field->linkType == 'multiple' ? 'multiple' : null), $htmlOptions)); $model->{$fieldName} = $oldAssignmentVal; return $dropdownList; case 'optionalAssignment': // optional assignment for users (can be left blank) $users = User::getNames(); unset($users['Anyone']); return CHtml::activeDropDownList($model, $fieldName, $users, array_merge(array('title' => $field->attributeLabel, 'empty' => ''), $htmlOptions)); case 'visibility': $permissionsBehavior = Yii::app()->params->modelPermissions; return CHtml::activeDropDownList($model, $field->fieldName, $permissionsBehavior::getVisibilityOptions(), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . "_visibility"), $htmlOptions)); // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone' // case 'int': // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array( // 'title' => $field->attributeLabel, // ), $htmlOptions)); // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone' // case 'int': // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array( // 'title' => $field->attributeLabel, // ), $htmlOptions)); case 'percentage': $htmlOptions['class'] = empty($htmlOptions['class']) ? 'input-percentage' : $htmlOptions['class'] . ' input-percentage'; return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions)); case 'currency': $fieldName = $field->fieldName; $elementId = isset($htmlOptions['id']) ? '#' . $htmlOptions['id'] : '#' . $field->modelName . '_' . $field->fieldName; Yii::app()->controller->widget('application.extensions.moneymask.MMask', array('element' => $elementId, 'currency' => Yii::app()->params['currency'], 'config' => array('affixStay' => true, 'decimal' => Yii::app()->locale->getNumberSymbol('decimal'), 'thousands' => Yii::app()->locale->getNumberSymbol('group')))); return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'class' => 'currency-field'), $htmlOptions)); case 'credentials': $typeAlias = explode(':', $field->linkType); $type = $typeAlias[0]; if (count($typeAlias) > 1) { $uid = Credentials::$sysUseId[$typeAlias[1]]; } else { $uid = Yii::app()->user->id; } return Credentials::selectorField($model, $field->fieldName, $type, $uid); case 'timerSum': // Sorry, no-can-do. This is field derives its value from a sum over timer records. return $model->renderAttribute($field->fieldName); case 'float': case 'int': if (isset($model->{$fieldName})) { $oldNumVal = $model->{$fieldName}; $model->{$fieldName} = Yii::app()->locale->numberFormatter->formatDecimal($model->{$fieldName}); } $input = CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions)); if (isset($oldNumVal)) { $model->{$fieldName} = $oldNumVal; } return $input; default: return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions)); // array( // 'tabindex'=>isset($item['tabindex'])? $item['tabindex'] : null, // 'disabled'=>$item['readOnly']? 'disabled' : null, // 'title'=>$field->attributeLabel, // 'style'=>$default?'color:#aaa;':null, // )); } }
* of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * X2Engine" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by X2Engine". *****************************************************************************************/ // drag and drop CSS always gets loaded, this prevents layout thrashing when the UI changes Yii::app()->clientScript->registerCssFile($this->module->assetsUrl . '/css/dragAndDrop.css'); Yii::app()->clientScript->registerCssFile($this->module->assetsUrl . '/css/view.css'); Yii::app()->clientScript->registerResponsiveCssFile($this->module->assetsUrl . '/css/responsiveDetailView.css'); Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/workflowFunnel.css'); Yii::app()->clientScript->registerPackages(array('X2History' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/X2History.js'), 'depends' => array('history', 'auxlib'))), true); Yii::app()->clientScript->registerScript('getWorkflowStage', "\n\nx2.WorkflowViewManager = (function () {\n\nfunction WorkflowViewManager (argsDict) {\n argsDict = typeof argsDict === 'undefined' ? {} : argsDict;\n var defaultArgs = {\n perStageWorkflowView: true,\n workflowId: {$model->id}\n };\n auxlib.applyArgs (this, defaultArgs, argsDict);\n\n this._init ();\n}\n\n/**\n * @param Number modelId (optional)\n */\nWorkflowViewManager._getQueryString = function (modelId, ajax) {\n var ajax = typeof ajax === 'undefined' ? true : ajax; \n var modelId = typeof modelId === 'undefined' ? x2.workflowViewManager.workflowId : modelId; \n\n return (\n (ajax ? 'workflowAjax=true&' : '') + 'id=' + modelId +\n '&start=" . Formatter::formatDate($dateRange['start']) . "' +\n '&end=" . Formatter::formatDate($dateRange['end']) . "' +\n '&range=" . $dateRange['range'] . "' +\n '&users=" . $users . "' +\n '&modelType=" . urlencode($modelType) . "');\n};\n\n/**\n * Requests stage member grids via AJAX \n */\nWorkflowViewManager.getStageMembers = function (stage) {\n\t\$.ajax({\n\t\turl: '" . CHtml::normalizeUrl(array('/workflow/workflow/getStageMembers')) . "',\n\t\ttype: 'GET',\n\t\tdata: \n WorkflowViewManager._getQueryString () + '&stage=' + stage,\n\t\tsuccess: function(response) {\n\t\t\tif(response === '') return;\n \$('#workflow-gridview').html(response);\n \$('#workflow-gridview').removeClass ('x2-layout-island');\n \$('#workflow-gridview').removeClass ('x2-layout-island-merge-bottom');\n \$('#content .x2-layout-island-merge-top-bottom').\n removeClass ('x2-layout-island-merge-top-bottom').\n addClass ('x2-layout-island-merge-top');\n \$.ajax({\n url: '" . CHtml::normalizeUrl(array('/workflow/workflow/getStageValue')) . "',\n data: \n WorkflowViewManager._getQueryString () + '&stage=' + stage,\n success: function(response) {\n \$('#data-summary-box').html(response);\n }\n });\n\t\t}\n\t});\n};\n\n/**\n * Depresses button in interface selection button group corresponding to currently selected\n * interface\n * @param bool perStageWorkflowView\n */\nWorkflowViewManager.prototype._updateChangeUIButtons = function (perStageWorkflowView) {\n \$('#interface-selection').children ().removeClass ('disabled-link');\n if (perStageWorkflowView) {\n \$('#per-stage-view-button').addClass ('disabled-link');\n \$('#workflow-filters').hide ();\n \$('#add-a-deal-button').hide ();\n } else {\n \$('#drag-and-drop-view-button').addClass ('disabled-link');\n \$('#workflow-filters').show ();\n \$('#add-a-deal-button').show ();\n }\n};\n\n/**\n * @param bool perStageWorkflowView \n * @param Number workflowId (optional)\n */\nWorkflowViewManager.prototype._changeUI = function (perStageWorkflowView, workflowId) {\n var that = this;\n \$.ajax ({\n url: '" . CHtml::normalizeUrl(array('/workflow/workflow/changeUI')) . "', \n\t\ttype: 'GET',\n\t\tdata: \n WorkflowViewManager._getQueryString (workflowId) + \n '&perStageWorkflowView=' + perStageWorkflowView,\n success: function (data) {\n if (data !== '') {\n that._pushState (workflowId, perStageWorkflowView);\n \$('.page-title').siblings ().remove ();\n \$('.page-title').after (\$('<div>'));\n \$('.page-title').next ().replaceWith (data);\n that._updateChangeUIButtons (perStageWorkflowView);\n that.perStageWorkflowView = perStageWorkflowView;\n x2.forms.initializeMultiselectDropdowns ();\n }\n }\n });\n};\n\n/**\n * Push browser state to preserve back button funtionality across ajax loaded pages\n */\nWorkflowViewManager.prototype._pushState = function (workflowId, perStageWorkflowView) {\n var newUrl = window.location.href.replace (/workflow\\/\\d+/, 'workflow/' + workflowId);\n newUrl = newUrl.replace (/id=\\d+/, 'id=' + workflowId);\n perStageWorkflowViewGETParamVal = perStageWorkflowView ? 'true' : 'false';\n newUrl = newUrl.replace (\n /perStageWorkflowView=[^&]+/, 'perStageWorkflowView=' + perStageWorkflowViewGETParamVal);\n\n x2.history.pushState (\n { workflowId: workflowId, \n perStageWorkflowView: perStageWorkflowView }, '', newUrl);\n};\n\nWorkflowViewManager.prototype._setUpWorkflowSelection = function () {\n var that = this;\n\n \$('#title-bar-workflow-select').unbind ('click._setUpWorkflowSelection')\n .bind ('click._setUpWorkflowSelection', function () {\n\n var workflowId = \$(this).val ();\n if (workflowId !== that.workflowId) {\n that._changeUI (that.perStageWorkflowView, workflowId);\n }\n that.workflowId = workflowId;\n });\n \n x2.history.bind (function () {\n var state = window.History.getState ();\n\n workflowId = state.data.workflowId;\n perStageWorkflowView = state.data.perStageWorkflowView;\n\n that._changeUI (perStageWorkflowView, workflowId);\n \$('#title-bar-workflow-select').val (workflowId);\n if (typeof workflowId !== 'undefined') {\n that.workflowId = workflowId;\n } \n return false;\n });\n\n};\n\n/**\n * Unselect pipeline/funnel menu item and selects funnel/pipeline menu item, respectively.\n * @param object menuItem the currently selected menu item <li> element\n * @param bool pipeline\n */\nWorkflowViewManager.prototype._swapViewMenuItems = function (menuItem, pipeline) {\n var pipeline = typeof pipeline === 'undefined' ? false : pipeline; \n\n \$(menuItem).children ().first ().replaceWith (\$('<span>', {\n html: \$(menuItem).children ().first ().html (),\n id: \$(menuItem).children ().first ().attr ('id')\n }));\n if (pipeline) {\n \$(menuItem).next ().children ().first ().replaceWith (\$('<a>', {\n html: \$(menuItem).next ().children ().first ().html (),\n id: \$(menuItem).next ().children ().first ().attr ('id'),\n href: '#',\n }));\n } else {\n \$(menuItem).prev ().children ().first ().replaceWith (\$('<a>', {\n html: \$(menuItem).prev ().children ().first ().html (),\n id: \$(menuItem).prev ().children ().first ().attr ('id'),\n href: '#'\n }));\n }\n};\n\n\n\n/**\n * Set up behavior of interface selection buttons \n */\nWorkflowViewManager.prototype._setUpUIChangeBehavior = function () {\n var that = this;\n \$('#interface-selection a').click (function (evt) {\n evt.preventDefault ();\n var id = \$(this).attr ('id'); \n\n if (id === 'per-stage-view-button') {\n if (!that.perStageWorkflowView) {\n that._swapViewMenuItems (\$('#funnel-view-menu-item').closest ('li'), true);\n that._changeUI (true, that.workflowId);\n }\n } else { // id === 'drag-and-drop-view-button\n if (that.perStageWorkflowView) {\n that._swapViewMenuItems (\$('#pipeline-view-menu-item').closest ('li'), false);\n that._changeUI (false, that.workflowId);\n }\n }\n\n return false;\n });\n \$('#funnel-view-menu-item').closest ('li').click (function (evt) {\n if (!that.perStageWorkflowView) {\n that._swapViewMenuItems (this, true);\n that._changeUI (true, that.workflowId);\n }\n return false;\n });\n \$('#pipeline-view-menu-item').closest ('li').click (function (evt) {\n if (that.perStageWorkflowView) {\n that._swapViewMenuItems (this, false);\n that._changeUI (false, that.workflowId);\n }\n return false;\n });\n};\n\nWorkflowViewManager.prototype._init = function () {\n this._setUpUIChangeBehavior ();\n this._setUpWorkflowSelection ();\n};\n\nreturn WorkflowViewManager;\n\n}) ();\n\n\$(function () { \n x2.workflowViewManager = new x2.WorkflowViewManager ({\n perStageWorkflowView: " . ($perStageWorkflowView ? 'true' : 'false') . "\n }); \n});\n\n\n", CClientScript::POS_HEAD); Yii::app()->clientScript->registerX2Flashes(); $this->setPageTitle(Yii::t('workflow', 'View {process}', array('{process}' => Modules::displayName(false)))); $menuOptions = array('index', 'create', 'edit', 'funnel', 'pipeline', 'delete'); $this->insertMenu($menuOptions, $model); // Handle disabling links for workflow views $unsetUrlIndex = $perStageWorkflowView ? 4 : 3; unset($this->actionMenu[3]['url'], $this->actionMenu[4]['url']); $this->actionMenu[$unsetUrlIndex]['url'] = '#'; ?> <div id='content-container-inner'> <div class="responsive-page-title page-title icon workflow "> <h2><span class="no-bold"> <?php echo Yii::t('workflow', '{process}:', array('{process}' => Modules::displayName(false))); ?>
/** * Helper method for the workflow view. * @return array links for each of the workflow stages. When clicked, the details of a * particular stage will be shown */ public static function getStageNameLinks(&$workflowStatus, $dateRange, $expectedCloseDateDateRange, $users) { $links = array(); $stageCount = count($workflowStatus['stages']); for ($i = 1; $i <= $stageCount; $i++) { $links[] = CHtml::link($workflowStatus['stages'][$i]['name'], array('/workflow/workflow/view', 'id' => $workflowStatus['id'], 'stage' => $i, 'start' => Formatter::formatDate($dateRange['start']), 'end' => Formatter::formatDate($dateRange['end']), 'range' => $dateRange['range'], 'expectedCloseDateStart' => Formatter::formatDate($expectedCloseDateDateRange['start']), 'expectedCloseDateEnd' => Formatter::formatDate($expectedCloseDateDateRange['end']), 'expectedCloseDateEnd' => Formatter::formatDate($expectedCloseDateDateRange['range']), $users), array('onclick' => 'x2.WorkflowViewManager.getStageMembers(' . $i . '); return false;', 'title' => addslashes($workflowStatus['stages'][$i]['name']))); } return $links; }
<div class="row"> <div class="cell"> <?php echo CHtml::label(Yii::t('charts', 'Start Date'), 'startDate'); ?> <?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $this->widget('CJuiDateTimePicker', array('name' => 'start', 'value' => Formatter::formatDate($dateRange['start']), 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker()), 'htmlOptions' => array('id' => 'startDate', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage())); ?> </div> <div class="cell"> <?php echo CHtml::label(Yii::t('charts', 'End Date'), 'startDate'); ?> <?php $this->widget('CJuiDateTimePicker', array('name' => 'end', 'value' => Formatter::formatDate($dateRange['end']), 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker()), 'htmlOptions' => array('id' => 'endDate', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage())); ?> </div> <div class="cell"> <?php echo CHtml::label(Yii::t('charts', 'Date Range'), 'range'); ?> <?php echo CHtml::dropDownList('range', $dateRange['range'], array('custom' => Yii::t('charts', 'Custom'), 'thisWeek' => Yii::t('charts', 'This Week'), 'thisMonth' => Yii::t('charts', 'This Month'), 'lastWeek' => Yii::t('charts', 'Last Week'), 'lastMonth' => Yii::t('charts', 'Last Month'), 'thisYear' => Yii::t('charts', 'This Year'), 'lastYear' => Yii::t('charts', 'Last Year')), array('id' => 'dateRange')); ?> </div> <div class="cell"> <?php echo CHtml::submitButton(Yii::t('charts', 'Go'), array('class' => 'x2-button', 'style' => 'margin-top:13px;')); ?> </div>
?> </div> </div> <div class="row"> <div class="cell dialog-cell"> <?php echo $form->label($model, $isEvent ? 'startDate' : 'dueDate', array('class' => 'dialog-label')); $defaultDate = Formatter::formatDate($model->dueDate, 'medium'); $model->dueDate = Formatter::formatDateTime($model->dueDate); //format date from DATETIME Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => 'dueDate', 'mode' => 'datetime', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'defaultDate' => $defaultDate, 'ampm' => Formatter::formatAMPM()), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage(), 'htmlOptions' => array('onClick' => "\$('#ui-datepicker-div').css('z-index', '10020');", 'id' => 'dialog-Actions_dueDate', 'readonly' => 'readonly', 'onChange' => 'giveSaveButtonFocus();'))); if ($isEvent) { echo $form->label($model, 'endDate', array('class' => 'dialog-label')); $defaultDate = Formatter::formatDate($model->completeDate, 'medium'); $model->completeDate = Formatter::formatDateTime($model->completeDate); //format date from DATETIME $this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => 'completeDate', 'mode' => 'datetime', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'defaultDate' => $defaultDate, 'ampm' => Formatter::formatAMPM()), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage(), 'htmlOptions' => array('onClick' => "\$('#ui-datepicker-div').css('z-index', '10020');", 'id' => 'dialog-Actions_startDate', 'readonly' => 'readonly', 'onChange' => 'giveSaveButtonFocus();'))); } ?> <?php echo $form->label($model, 'allDay', array('class' => 'dialog-label')); ?> <?php echo $form->checkBox($model, 'allDay', array('onChange' => 'giveSaveButtonFocus();')); ?> </div>
* Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * X2Engine" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by X2Engine". *****************************************************************************************/ ?> <div class="cell"> <?php echo CHtml::label($this->startDateLabel, $this->startDateName); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $this->widget('CJuiDateTimePicker', array('name' => $this->startDateName, 'value' => Formatter::formatDate($this->startDateValue), 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), 'htmlOptions' => array('class' => 'start-date', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage())); ?> </div> <div class="cell"> <?php echo CHtml::label($this->endDateLabel, $this->endDateName); $this->widget('CJuiDateTimePicker', array('name' => $this->endDateName, 'value' => Formatter::formatDate($this->endDateValue), 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), 'htmlOptions' => array('class' => 'end-date', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage())); ?> </div> <div class="cell"> <?php echo CHtml::label($this->dateRangeLabel, $this->dateRangeName); echo CHtml::dropDownList($this->dateRangeName, $this->dateRangeValue, array('custom' => Yii::t('charts', 'Custom'), 'thisWeek' => Yii::t('charts', 'This Week'), 'thisMonth' => Yii::t('charts', 'This Month'), 'lastWeek' => Yii::t('charts', 'Last Week'), 'lastMonth' => Yii::t('charts', 'Last Month'), 'thisYear' => Yii::t('charts', 'This Year'), 'lastYear' => Yii::t('charts', 'Last Year'), 'all' => Yii::t('charts', 'All Time')), array('class' => 'date-range')); ?> </div>
} ?> </td> </tr> <tr> <td class="label"><?php echo CHtml::label(Yii::t('workflow', 'Completed'), 'completeDate'); ?> </td> <td class="text-field"> <span><?php echo $model->completeDate; ?> </span> <?php $model->completeDate = Formatter::formatDate($model->completeDate); if ($editable) { $this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => 'completeDate', 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true, 'minDate' => $minDate, 'maxDate' => '0'), 'htmlOptions' => array('title' => Yii::t('actions', 'Complete Date')), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage())); } ?> </td> </tr> <tr> <td class="label"><?php echo CHtml::label(Yii::t('workflow', 'Completed By'), 'completedBy'); ?> </td> <td class="text-field"> <span><?php if (!empty($model->completedBy) && $model->complete == 'Yes' && isset($users[$model->completedBy])) { echo $users[$model->completedBy];
* * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * X2Engine" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by X2Engine". *****************************************************************************************/ ?> <div id='per-stage-view-container-first' class='x2-layout-island x2-layout-island-merge-top-bottom'> <?php $this->renderFunnelView($model->id, $dateRange, $expectedCloseDateDateRange, $users, null, $modelType); //$workflowStatus = Workflow::getWorkflowStatus($model->id, 0, $modelType); // true = include dropdowns //echo Workflow::renderWorkflowStats($workflowStatus, $modelType); ?> <?php $this->renderPartial('_processStatus', array('dateRange' => $dateRange, 'expectedCloseDateDateRange' => $expectedCloseDateDateRange, 'model' => $model, 'modelType' => $modelType, 'users' => $users)); ?> </div> <div id="workflow-gridview" class='x2-layout-island x2-layout-island-merge-top' style="clear:both;"> <?php if (isset($viewStage)) { // display grids for individual stages echo Yii::app()->controller->getStageMembers($model->id, $viewStage, Formatter::formatDate($dateRange['start']), Formatter::formatDate($dateRange['end']), $dateRange['range'], Formatter::formatDate($expectedCloseDateDateRange['start']), Formatter::formatDate($expectedCloseDateDateRange['end']), $expectedCloseDateDateRange['range'], $users, $modelType); } else { // display information about all stages $this->widget('zii.widgets.grid.CGridView', array('baseScriptUrl' => Yii::app()->request->baseUrl . '/themes/' . Yii::app()->theme->name . '/css/gridview', 'template' => '{items}{pager}', 'dataProvider' => X2Model::model('WorkflowStage')->search($model->id), 'columns' => array(array('name' => 'stageNumber', 'header' => '#', 'headerHtmlOptions' => array('style' => 'width:8%;')), array('name' => 'name', 'type' => 'raw'), array('name' => 'requirePrevious', 'value' => 'Yii::t("app",($data->requirePrevious? "Yes" : "No"))', 'type' => 'raw', 'headerHtmlOptions' => array('style' => 'width:15%;')), array('name' => 'requireComment', 'value' => 'Yii::t("app",($data->requireComment? "Yes" : "No"))', 'type' => 'raw', 'headerHtmlOptions' => array('style' => 'width:15%;')), array('name' => 'conversionRate', 'headerHtmlOptions' => array('style' => 'width:15%;')), array('name' => 'value', 'headerHtmlOptions' => array('style' => 'width:15%;'))))); } ?> </div>