Esempio n. 1
0
 public static function tearDownAfterClass()
 {
     $leadSourceDropdown = Dropdowns::model()->findByPk(103);
     $leadSourceDropdown->multi = 0;
     $leadSourceDropdown->save();
     return parent::tearDownAfterClass();
 }
Esempio n. 2
0
 public static function getSocialSubtypes()
 {
     $dropdown = Dropdowns::model()->findByPk(113);
     if (!$dropdown) {
         return array();
     }
     return json_decode($dropdown->options, true);
 }
Esempio n. 3
0
 public static function statusList()
 {
     $field = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'status'));
     $dropdown = Dropdowns::model()->findByPk($field->linkType);
     return json_decode($dropdown->options);
     /*
     		return array(
     		    'Draft'=>Yii::t('quotes','Draft'),
     		    'Presented'=>Yii::t('quotes','Presented'),
     		    "Issued"=>Yii::t('quotes','Issued'),
     		    "Won"=>Yii::t('quotes','Won')
     		); */
 }
Esempio n. 4
0
?>
		</div>
		<div class="cell">
			<?php 
echo CHtml::label(Yii::t('dashboard', 'Date Range'), 'range');
?>
			<?php 
echo CHtml::dropDownList('range', $dateRange['range'], array('custom' => Yii::t('dashboard', 'Custom'), 'thisWeek' => Yii::t('dashboard', 'This Week'), 'thisMonth' => Yii::t('dashboard', 'This Month'), 'lastWeek' => Yii::t('dashboard', 'Last Week'), 'lastMonth' => Yii::t('dashboard', 'Last Month'), 'thisYear' => Yii::t('dashboard', 'This Year'), 'lastYear' => Yii::t('dashboard', 'Last Year')), array('id' => 'dateRange'));
?>
		</div>
	</div>
	<div class="row">
		<div class="cell">
			<?php 
echo $form->label($model, 'leadSource');
$dropdown = Dropdowns::model()->findByPk(4);
// lead source
$dropdowns = json_decode($dropdown->options, true);
foreach (array_keys($dropdowns) as $key) {
    $dropdowns[$key] = Yii::t(strtolower(Yii::app()->controller->id), $dropdowns[$key]);
}
$dropdowns = array('' => '---') + $dropdowns;
echo $form->dropDownList($model, 'leadSource', $dropdowns, array());
?>
		</div>
		<div class="cell">
			<?php 
echo $form->label($model, 'company');
$linkId = '';
// if the field is an ID, look up the actual name
if (isset($model->company) && ctype_digit($model->company)) {
Esempio n. 5
0
 public function getDropdown()
 {
     if ($this->type !== 'dropdown') {
         return null;
     }
     if (!isset($this->_dropdown)) {
         $this->_dropdown = Dropdowns::model()->findByPk($this->linkType);
     }
     return $this->_dropdown;
 }
Esempio n. 6
0
<div class="form">
	<?php 
$feed = new Social();
?>
	<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'feed-form', 'enableAjaxValidation' => false, 'method' => 'post', 'action' => array('addPost', 'id' => Yii::app()->user->getId(), 'redirect' => 'index')));
?>
	
	<div class="float-row">
		<?php 
$feed->data = Yii::t('app', 'Enter text here...');
echo $form->textArea($feed, 'data', array('style' => 'width:558px;height:50px;color:#aaa;display:block;clear:both;'));
echo $form->dropDownList($feed, 'associationId', $users);
$feed->visibility = 1;
echo $form->dropDownList($feed, 'visibility', array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')));
echo $form->dropDownList($feed, 'subtype', json_decode(Dropdowns::model()->findByPk(14)->options, true));
echo CHtml::submitButton(Yii::t('app', 'Post'), array('class' => 'x2-button', 'id' => 'save-button'));
echo CHtml::button(Yii::t('app', 'Attach A File/Photo'), array('class' => 'x2-button', 'onclick' => "\$('#attachments').toggle();"));
?>
	</div>
	<?php 
$this->endWidget();
?>
</div>


<div id="attachments" style="display:none;">
<?php 
$this->widget('Attachments', array('associationType' => 'feed', 'associationId' => Yii::app()->user->getId()));
?>
</div>
Esempio n. 7
0
?>
    <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'feed-form', 'enableAjaxValidation' => false, 'method' => 'post'));
?>
    <div class="float-row" style='overflow:visible;'>
        <?php 
echo $form->textArea($feed, 'text', array('style' => 'width:99%;height:25px;color:#aaa;display:block;clear:both;'));
echo "<div id='post-buttons' style='display:none;'>";
echo $form->dropDownList($feed, 'associationId', $users, array('style' => $isMyProfile ? '' : 'display:none;', 'class' => 'x2-select'));
$feed->visibility = 1;
echo $form->dropDownList($feed, 'visibility', array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')), array('class' => 'x2-select'));
function translateOptions($item)
{
    return Yii::t('app', $item);
}
echo $form->dropDownList($feed, 'subtype', array_map('translateOptions', json_decode(Dropdowns::model()->findByPk(113)->options, true)), array('class' => 'x2-select'));
?>
        <div id='second-row-buttons-container'>
            <?php 
echo CHtml::submitButton(Yii::t('app', 'Post'), array('class' => 'x2-button', 'id' => 'save-button'));
if ($isMyProfile) {
    echo CHtml::button(Yii::t('app', 'Attach A File/Photo'), array('class' => 'x2-button', 'onclick' => "\$('#attachments').slideToggle();", 'id' => "toggle-attachment-menu-button"));
}
?>
        </div>
        </div>
        <?php 
?>
    </div>
    <?php 
$this->endWidget();
Esempio n. 8
0
 public function actionGetFields($model)
 {
     if (!class_exists($model)) {
         echo 'false';
         return;
     }
     $fieldModels = X2Model::model($model)->getFields();
     $fields = array();
     foreach ($fieldModels as &$field) {
         if ($field->isVirtual) {
             continue;
         }
         $data = array('name' => $field->fieldName, 'label' => $field->attributeLabel, 'type' => $field->type);
         if ($field->required) {
             $data['required'] = 1;
         }
         if ($field->readOnly) {
             $data['readOnly'] = 1;
         }
         if ($field->type === 'assignment' || $field->type === 'optionalAssignment') {
             $data['options'] = AuxLib::dropdownForJson(X2Model::getAssignmentOptions(true, true));
             if ($field->type === 'assignment') {
                 $data['multiple'] = $field->linkType === 'multiple' ? 1 : 0;
             }
         } elseif ($field->type === 'dropdown') {
             $data['linkType'] = $field->linkType;
             $dropdown = Dropdowns::model()->findByPk($field->linkType);
             if (!$dropdown) {
                 continue;
             }
             $data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($field->linkType));
             $data['multiple'] = $dropdown->multi ? 1 : 0;
         }
         if ($field->type === 'link') {
             $staticLinkModel = X2Model::model($field->linkType);
             if (array_key_exists('X2LinkableBehavior', $staticLinkModel->behaviors())) {
                 $data['linkType'] = $field->linkType;
                 $data['linkSource'] = Yii::app()->controller->createUrl($staticLinkModel->autoCompleteSource);
             }
         }
         $fields[] = $data;
     }
     usort($fields, function ($a, $b) {
         return strcmp($a['label'], $b['label']);
     });
     echo CJSON::encode($fields);
 }
Esempio n. 9
0
}
$fieldTypes = Fields::getFieldTypes('title');
echo $form->dropDownList($model, 'type', ArrayUtil::asorti($fieldTypes), array('id' => 'fieldType', 'class' => $new ? 'new' : 'existing'));
?>
            <?php 
echo $form->error($model, 'type');
?>
        </div>
            <div class="row">
                <?php 
// Render a dropdown menu and any other fields
// for the "linkType" field
$genericLabel = CHtml::label(Yii::t('app', 'Type'), CHtml::resolveName($model, $assignTypeName));
switch ($model->type) {
    case "dropdown":
        $dropdowns = Dropdowns::model()->findAll();
        $arr = array();
        foreach ($dropdowns as $dropdown) {
            $arr[$dropdown->id] = $dropdown->name;
        }
        echo CHtml::activeDropDownList($model, 'linkType', $arr, array('id' => 'dropdown-type', 'class' => $new ? 'new' : 'existing'));
        break;
    case "assignment":
        $assignTypeName = 'linkType';
        echo $genericLabel;
        echo CHtml::activeDropDownList($model, 'linkType', array(NULL => Yii::t('app', 'Single'), 'multiple' => Yii::t('app', 'Multiple')), array('id' => 'assignment-multiplicity', 'class' => $new ? 'new' : 'existing'));
        break;
    case "link":
        $linkTypes = Fields::getLinkTypes();
        $options = array();
        foreach ($linkTypes as $type) {
Esempio n. 10
0
?>
' value='' />-->
    <textarea type='text' name='name' id='feed-post-editor' 
     placeholder='<?php 
echo Yii::t('app', 'Enter text here...');
?>
'></textarea>
    <fieldset data-role='controlgroup' data-type='horizontal'>
<?php 
$userIds = array_keys($users);
$firstUser = $userIds[0];
echo CHtml::dropDownList('associationId', $firstUser, $users, array('data-mini' => 'true', 'id' => 'feed-post-association-id'));
echo CHtml::dropDownList('visibility', 1, array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')), array('data-mini' => 'true', 'id' => 'feed-post-visibility'));
echo CHtml::dropDownList('subtype', 1, array_map(function ($item) {
    return Yii::t('app', $item);
}, json_decode(Dropdowns::model()->findByPk(113)->options, true)), array('data-mini' => 'true', 'id' => 'feed-post-subtype'));
?>
    </fieldset>
    <button type='submit' class='x2-button' id='feed-post-button' 
     data-inline='true'><?php 
echo Yii::t('app', 'Submit Post');
?>
</button>
     <?php 
echo X2Html::csrfToken();
?>
</form>
<div id="attachments" style='display: none;'>
<?php 
$this->widget('Attachments', array('associationType' => 'feed', 'associationId' => Yii::app()->user->getId(), 'mobile' => true));
?>
Esempio n. 11
0
         break;
     case 'percentage':
         $type = 'percentageIcon';
         break;
     case 'credentials':
         $type = 'dropdownIcon';
         break;
     default:
         $type = 'varcharIcon';
 }
 echo '<div class="formItem leftLabel" id="formItem_' . $field->fieldName . '"><div class="formTabOrder"></div><label class="' . $type . '">' . X2Model::model($modelName)->getAttributeLabel($field->fieldName) . '</label>';
 echo '<div class="formInputBox">';
 if ($field->type == 'text') {
     echo CHtml::textArea($modelName . '_' . $field->fieldName, '', array('title' => $field->attributeLabel));
 } elseif ($field->type == 'dropdown') {
     $dropdown = Dropdowns::model()->findByPk($field->linkType);
     if (isset($dropdown)) {
         echo CHtml::dropDownList($modelName . '_' . $field->fieldName, '', json_decode($dropdown->options), array('title' => $field->attributeLabel));
     } else {
         echo CHtml::textField($modelName . '_' . $field->fieldName, '', array('title' => $field->attributeLabel));
     }
 } elseif ($field->type == 'boolean') {
     echo '<div class="checkboxWrapper">';
     echo CHtml::checkBox($modelName . '_' . $field->fieldName, false, array('title' => $field->attributeLabel)) . '</div>';
 } elseif ($field->type == 'assignment') {
     echo CHtml::dropDownList($field->fieldName, '', array('Users'), array('title' => $field->attributeLabel));
 } elseif ($field->type == 'visibility') {
     echo CHtml::dropDownList($field->fieldName, '', array(1 => 'Public', 0 => 'Private', 2 => 'User\'s Groups'), array('title' => $field->attributeLabel));
 } else {
     echo CHtml::textField($modelName . '_' . $field->fieldName, '', array('title' => $field->attributeLabel));
 }
Esempio n. 12
0
 /**
  * Gets possible values for a field.
  *
  * Note, this is meant to be a stripped-down imitation of what is in
  * {@link X2Model} already. I know this is code duplication, but considering 
  *
  * Note, does not yet handle multiple choice (selecting more than one).
  * 
  * @param Fields $field
  */
 public function fieldOptions(Fields $field)
 {
     switch ($field->type) {
         case 'assignment':
             return X2Model::getAssignmentOptions(true, true, false);
         case 'credentials':
             $typeArr = explode(':', $field->linkType);
             $type = $typeArr[0];
             if (count($typeAlias) > 1) {
                 $uid = Credentials::$sysUseId[$typeAlias[1]];
             } else {
                 $uid = Yii::app()->getSuId();
             }
             if (count($typeArr > 0)) {
                 $uid = $typeArr[1];
             }
             $config = Credentials::getCredentialOptions($this->staticModel, $field->fieldName, $type, $uid);
             return $config['credentials'];
         case 'dropdown':
             // Dropdown options
             $dropdown = Dropdowns::model()->findByPk($field->linkType);
             if ($dropdown instanceof Dropdowns) {
                 return json_decode($dropdown->options, 1);
             }
             break;
         case 'optionalAssignment':
             $options = X2Model::getAssignmentOptions(true, true, false);
             unset($options['Anyone']);
             $options[''] = '';
             return $options;
         case 'rating':
             return range(Fields::RATING_MIN, Fields::RATING_MAX);
         case 'varchar':
             // Special kludge for actions priority dropdown mapping
             if ($field->modelName == 'Actions' && $field->fieldName == 'priority') {
                 return Actions::getPriorityLabels();
             }
             break;
         case 'visibility':
             $permissionsBehavior = Yii::app()->params->modelPermissions;
             return $permissionsBehavior::getVisibilityOptions();
     }
     return array();
 }
Esempio n. 13
0
 public function getViewFileParams()
 {
     if (!isset($this->_viewFileParams)) {
         $this->_viewFileParams = array_merge(parent::getViewFileParams(), array('userNames' => User::getNames(), 'socialSubtypes' => json_decode(Dropdowns::model()->findByPk(113)->options, true), 'visibilityFilters' => array('1' => 'Public', '0' => 'Private'), 'chartSettingsDataProvider' => self::getChartSettingsProvider($this->chartType), 'suppressChartSettings' => false, 'metricTypes' => array('any' => Yii::t('app', 'All Events'), 'notif' => Yii::t('app', 'Notifications'), 'feed' => Yii::t('app', 'Feed Events'), 'comment' => Yii::t('app', 'Comments'), 'record_create' => Yii::t('app', 'Records Created'), 'record_deleted' => Yii::t('app', 'Records Deleted'), 'weblead_create' => Yii::t('app', 'Webleads Created'), 'workflow_start' => Yii::t('app', '{Process} Started', array('{Process}' => Modules::displayName(false, 'Workflow'))), 'workflow_complete' => Yii::t('app', '{Process} Complete', array('{Process}' => Modules::displayName(false, 'Workflow'))), 'workflow_revert' => Yii::t('app', '{Process} Reverted', array('{Process}' => Modules::displayName(false, 'Workflow'))), 'email_sent' => Yii::t('app', 'Emails Sent'), 'email_opened' => Yii::t('app', 'Emails Opened'), 'web_activity' => Yii::t('app', 'Web Activity'), 'case_escalated' => Yii::t('app', 'Cases Escalated'), 'calendar_event' => Yii::t('app', '{Calendar} Events', array('{Calendar}' => Modules::displayName(false, 'Calendar'))), 'action_reminder' => Yii::t('app', '{Action} Reminders', array('{Action}' => Modules::displayName(false, 'Actions'))), 'action_complete' => Yii::t('app', '{Actions} Completed', array('{Actions}' => Modules::displayName(true, 'Actions'))), 'doc_update' => Yii::t('app', 'Doc Updates'), 'email_from' => Yii::t('app', 'Email Received'), 'voip_calls' => Yii::t('app', 'VOIP Calls'), 'media' => Yii::t('app', '{Media}', array('{Media}' => Modules::displayName(true, 'Media')))), 'chartType' => 'eventsChart', 'widgetUID' => $this->widgetUID));
     }
     return $this->_viewFileParams;
 }
Esempio n. 14
0
 * 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".
 *****************************************************************************************/
Yii::app()->clientScript->registerCss('feedFiltersCSs', "\n#feed-filters .x2-multiselect-dropdown-menu {\n    margin-right: 3px;\n    margin-bottom: 4px;\n}\n\n\n#feed-filters-button {\n    color: inherit;\n    text-decoration: none;\n    opacity: 0.5;\n    margin-right: 9px;\n    margin-top: 3px;\n}\n#feed-filters-button > span {\n    display: block;\n}\n#feed-filters-button:hover {\n    opacity: 0.7;\n}\n\na#toggle-filters-link {\n    margin-bottom: 4px;\n}\n\n\n#full-controls-button-container {\n    margin-top: 5px;\n}\n\n#full-controls-button-container > a {\n    margin-right: 3px;\n}\n\n#full-controls,\n#simple-controls {\n    padding-left: 5px;\n}\n\n#execute-feed-filters-button {\n    margin-left: 11px;\n    height: 18px;\n    line-height: 18px;\n}\n\n#filter-default {\n    margin-top: 6px;\n    margin-left: 8px;\n}\n\n#feed-filters .x2-button-group {\n    margin-top: 8px;\n}\n\n#filter-controls > .portlet-content {\n    padding: 5px 0px !important;\n}\n\n#filter-controls > .portlet-content > .x2-button-group {\n    margin-bottom: 5px;\n}\n\n");
?>
<div id='feed-filters' style='display: none;'>
<?php 
if (isset($_SESSION['filters'])) {
    $filters = $_SESSION['filters'];
} else {
    $filters = array('visibility' => array(), 'users' => array(), 'types' => array(), 'subtypes' => array());
}
$visibility = array('1' => 'Public', '0' => 'Private');
$socialSubtypes = json_decode(Dropdowns::model()->findByPk(113)->options, true);
$users = User::getNames();
$eventTypeList = Yii::app()->db->createCommand()->select('type')->from('x2_events')->group('type')->queryAll();
$eventTypes = array();
foreach ($eventTypeList as $key => $value) {
    if ($value['type'] != 'comment') {
        $eventTypes[$value['type']] = Events::parseType($value['type']);
    }
}
$profile = Yii::app()->params->profile;
echo '<div class="x2-button-group">';
echo '<a href="#" class="simple-filters x2-button' . ($profile->fullFeedControls ? "" : " disabled-link") . '" style="width:42px">' . Yii::t('app', 'Simple') . '</a>';
echo '<a href="#" class="full-filters x2-button x2-last-child' . ($profile->fullFeedControls ? " disabled-link" : "") . '" style="width:42px">' . Yii::t('app', 'Full') . '</a>';
echo "</div>\n";
echo "<div id='full-controls'" . ($profile->fullFeedControls ? "" : "style='display:none;'") . ">";
echo CHtml::dropDownList('visibilityFilters', array_map(function ($a) use($visibility) {
Esempio n. 15
0
<a href="#" onclick="$('#deleteDropdown').toggle();$('#createDropdown').hide();$('#editDropdown').hide();return false;" class="x2-button"><?php 
echo Yii::t('admin', 'Delete Dropdown');
?>
</a>
<a href="#" onclick="$('#editDropdown').toggle();$('#createDropdown').hide();$('#deleteDropdown').hide();return false;" class="x2-button"><?php 
echo Yii::t('admin', 'Edit Dropdown');
?>
</a>
<br>
<br>
</div>
<div id="createDropdown" style="display:none;">
    <?php 
$this->renderPartial('createDropdown', array('model' => $model));
?>
</div>
<div id="deleteDropdown" style="display:none;">
<?php 
$customDropdowns = Dropdowns::model()->findAll('id>=1000');
usort($customDropdowns, function ($a, $b) {
    return strcmp($a->name, $b->name);
});
$this->renderPartial('deleteDropdown', array('dropdowns' => $customDropdowns));
?>
</div>
<div id="editDropdown" style="display:none;">
<?php 
$this->renderPartial('editDropdown', array('model' => $model));
?>
</div>
Esempio n. 16
0
 public function renderFilterCellContent()
 {
     switch ($this->fieldType) {
         case 'boolean':
             echo CHtml::activeDropdownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', '1' => Yii::t('app', 'Yes'), 'false' => Yii::t('app', "No")), array('class' => 'x2-minimal-select-filtercol'));
             break;
         case 'dropdown':
             $dropdown = Dropdowns::model()->findByPk($this->fieldModel['linkType']);
             if ($dropdown instanceof Dropdowns) {
                 $options = json_decode($dropdown->options, 1);
                 if (!$dropdown->multi) {
                     $defaultOption = array('' => '- ' . Yii::t('app', 'Select') . ' -');
                     $options = is_array($options) ? array_merge($defaultOption, $options) : $defaultOption;
                 }
                 //$selected = isset($options[$this->grid->filter->{$this->name}]) ?
                 //$this->grid->filter->{$this->name} : '';
                 echo CHtml::activeDropdownList($this->grid->filter, $this->name, $options, array('class' => 'x2-minimal-select-filtercol' . ($dropdown->multi ? ' x2-multiselect-dropdown x2-datacolumn-multiselect' : ''), 'multiple' => $dropdown->multi ? 'multiple' : '', 'data-selected-text' => $dropdown->multi ? 'option(s)' : ''));
             } else {
                 parent::renderFilterCellContent();
             }
             break;
         case 'visibility':
             echo CHtml::activeDropDownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', 1 => Yii::t('app', 'Public'), 0 => Yii::t('app', 'Private'), 2 => Yii::t('app', 'User\'s Groups')), array('class' => 'x2-minimal-select-filtercol'));
             break;
         case 'dateTime':
         case 'date':
             Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
             $that = $this;
             $renderWidget = function () use($that) {
                 echo Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $that->grid->filter, 'attribute' => $that->name, 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium')), 'htmlOptions' => array('id' => 'datePicker' . $that->name, 'class' => 'datePicker x2-gridview-filter-datepicker'), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
             };
             if ($this->grid->ajax) {
                 X2Widget::ajaxRender($renderWidget);
             } else {
                 $renderWidget();
             }
             break;
         default:
             parent::renderFilterCellContent();
     }
 }
Esempio n. 17
0
 /**
  * Send the chart type to the widget content view 
  */
 public function getViewFileParams()
 {
     if (!isset($this->_viewFileParams)) {
         $this->_viewFileParams = array_merge(parent::getViewFileParams(), array('chartType' => $this->chartType, 'chartSettingsDataProvider' => self::getChartSettingsProvider($this->chartType), 'eventTypes' => array('all' => Yii::t('app', 'All Events')) + Events::$eventLabels, 'socialSubtypes' => json_decode(Dropdowns::model()->findByPk(113)->options, true), 'visibilityFilters' => array('1' => 'Public', '0' => 'Private'), 'suppressChartSettings' => false, 'chartType' => 'usersChart', 'widgetUID' => $this->widgetUID, 'metricTypes' => User::getUserOptions()));
     }
     return $this->_viewFileParams;
 }
Esempio n. 18
0
 * 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="page-title rounded-top"><h2><?php 
echo Yii::t('admin', 'Edit Dropdown');
?>
</h2></div>
<div class="form">
<?php 
$list = Dropdowns::model()->findAll();
$names = array();
foreach ($list as $dropdown) {
    $names[$dropdown->id] = $dropdown->name;
}
$form = $this->beginWidget('CActiveForm', array('id' => 'edit-dropdown-form', 'enableAjaxValidation' => false, 'action' => 'editDropdown'));
?>

	<em><?php 
echo Yii::t('app', 'Fields with <span class="required">*</span> are required.');
?>
</em><br />

        <div class="row">
            <?php 
echo $form->labelEx($model, 'name');
Esempio n. 19
0
 /**
  * Print out a dropdown's data
  *
  * This method is called via AJAX by {@link actionEditDropdown} to get the
  * options of the dropdown for the edit dropdown page.
  */
 public function actionGetDropdown()
 {
     if (isset($_POST['Dropdowns']['id'])) {
         $id = $_POST['Dropdowns']['id'];
         $model = Dropdowns::model()->findByPk($id);
         if ($model === null) {
             return;
         }
         $options = json_decode($model->options);
         if ($id == Actions::COLORS_DROPDOWN_ID) {
             $this->renderPartial('application.modules.actions.views.actions._colorDropdownForm', array('model' => $model, 'options' => $options), false, true);
         } else {
             $this->renderPartial('application.components.views._dropdownForm', array('model' => $model, 'options' => $options), false, true);
         }
     }
 }
Esempio n. 20
0
 public function actionGetFieldType()
 {
     if (isset($_POST['Fields']['type'])) {
         $type = $_POST['Fields']['type'];
         if ($type == "dropdown") {
             $dropdowns = Dropdowns::model()->findAll();
             $arr = array();
             foreach ($dropdowns as $dropdown) {
                 $arr[$dropdown->id] = $dropdown->name;
             }
             echo CHtml::dropDownList('dropdown', '', $arr);
         } elseif ($type == 'link') {
             $arr = array();
             $modules = Modules::model()->findAll();
             foreach ($modules as $module) {
                 if ($module->searchable) {
                     if ($module->name != "products") {
                         $arr[$module->name] = $module->title;
                     } else {
                         $arr['product'] = "Products";
                     }
                 }
             }
             echo CHtml::dropDownList('dropdown', '', $arr);
         }
     }
 }