Inheritance: extends CWidget
Beispiel #1
0
 /**
  * @param Grido\Grid $grid
  * @param string $name
  * @param string $label
  * @param string $dateFormat
  */
 public function __construct($grid, $name, $label, $dateFormat = NULL)
 {
     parent::__construct($grid, $name, $label);
     if ($dateFormat !== NULL) {
         $this->dateFormat = $dateFormat;
     }
 }
Beispiel #2
0
 /**
  * @param mixed $value
  * @return string
  */
 protected function formatValue($value)
 {
     $value = parent::formatValue($value);
     $decimals = $this->numberFormat[self::NUMBER_FORMAT_DECIMALS];
     $decPoint = $this->numberFormat[self::NUMBER_FORMAT_DECIMAL_POINT];
     $thousandsSep = $this->numberFormat[self::NUMBER_FORMAT_THOUSANDS_SEPARATOR];
     return is_numeric($value) ? number_format($value, $decimals, $decPoint, $thousandsSep) : $value;
 }
 public function renderDataCellContent($row, $data)
 {
     $isModel = $data instanceof CModel;
     if ($isModel) {
         $widgetClass = 'EditableField';
         $attribute = empty($this->editable['attribute']) ? $this->name : $this->editable['attribute'];
         $options = array('model' => $data, 'attribute' => $attribute);
         //if value defined in column config --> we should evaluate it
         //and pass to widget via `text` option: set flag `passText` = true
         $passText = !empty($this->value);
     } else {
         $widgetClass = 'Editable';
         $options = array('pk' => $data[$this->grid->dataProvider->keyField], 'name' => empty($this->editable['name']) ? $this->name : $this->editable['name']);
         $passText = true;
         //if autotext will be applied, do not pass `text` option (pass `value` instead)
         if (empty($this->value) && Editable::isAutotext($this->editable, isset($this->editable['type']) ? $this->editable['type'] : '')) {
             $options['value'] = $data[$this->name];
             $passText = false;
         }
     }
     //for live update
     $options['liveTarget'] = $this->grid->id;
     $options = CMap::mergeArray($this->editable, $options);
     //get text for element
     $ctext = CHtml::value($data, $attribute);
     //if value defined for column --> use it as element text
     if ($passText) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $ctext = $text;
         $options['text'] = $text;
         $options['encode'] = false;
     }
     //apply may be a string expression, see https://github.com/vitalets/x-editable-yii/issues/33
     if (isset($options['apply']) && is_string($options['apply'])) {
         $options['apply'] = $this->evaluateExpression($options['apply'], array('data' => $data, 'row' => $row));
     }
     //evaluate htmlOptions inside editable config as they can depend on $data
     //see https://github.com/vitalets/x-editable-yii/issues/40
     if (isset($options['htmlOptions']) && is_array($options['htmlOptions'])) {
         foreach ($options['htmlOptions'] as $k => $v) {
             if (is_string($v) && (strpos($v, '$data') !== false || strpos($v, '$row') !== false)) {
                 $options['htmlOptions'][$k] = $this->evaluateExpression($v, array('data' => $data, 'row' => $row));
             }
         }
     }
     $this->grid->controller->widget($widgetClass, $options);
     //Added to support creating models on the fly
     //$ctext = CHtml::value($data, $attribute);
     $mClass = empty($this->modelName) ? get_class($data) : $this->modelName;
     if (empty($this->parentModel)) {
         echo cHtml::openTag('input', array('type' => 'hidden', 'class' => "optvalinput{$attribute}", 'id' => "{$mClass}_{$row}_{$attribute}", 'name' => "{$mClass}[{$row}][{$attribute}]", 'value' => $ctext));
     } else {
         echo cHtml::openTag('input', array('type' => 'hidden', 'class' => "optvalinput{$attribute}", 'id' => "{$this->parentModel[1]}_{$this->parentModel[0]}_{$mClass}_{$row}_{$attribute}", 'name' => "{$this->parentModel[1]}[{$this->parentModel[0]}][{$mClass}][{$row}][{$attribute}]", 'value' => $ctext));
     }
     echo cHtml::closeTag('input');
 }
Beispiel #4
0
 /**
  * @param mixed $value
  * @return mixed
  */
 protected function formatValue($value)
 {
     $value = parent::formatValue($value);
     if ($this->truncate) {
         $truncate = $this->truncate;
         $value = $truncate($value);
     }
     return $value;
 }
Beispiel #5
0
 public function renderDataCellContent($row, $data)
 {
     $isModel = $data instanceof CModel;
     if ($isModel) {
         $widgetClass = 'EditableField';
         $options = array('model' => $data, 'attribute' => empty($this->editable['attribute']) ? $this->name : $this->editable['attribute']);
         //if value defined in column config --> we should evaluate it
         //and pass to widget via `text` option: set flag `passText` = true
         $passText = !empty($this->value);
     } else {
         $widgetClass = 'Editable';
         $options = array('pk' => $data[$this->grid->dataProvider->keyField], 'name' => empty($this->editable['name']) ? $this->name : $this->editable['name']);
         $passText = true;
         //if autotext will be applied, do not pass `text` option (pass `value` instead)
         if (empty($this->value) && Editable::isAutotext($this->editable, isset($this->editable['type']) ? $this->editable['type'] : '')) {
             $options['value'] = $data[$this->name];
             $passText = false;
         }
     }
     //for live update
     $options['liveTarget'] = $this->grid->id;
     $options = CMap::mergeArray($this->editable, $options);
     //if value defined for column --> use it as element text
     if ($passText) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $options['text'] = $text;
         $options['encode'] = false;
     }
     //apply may be a string expression, see https://github.com/vitalets/x-editable-yii/issues/33
     if (isset($options['apply']) && is_string($options['apply'])) {
         $options['apply'] = $this->evaluateExpression($options['apply'], array('data' => $data, 'row' => $row));
     }
     //evaluate htmlOptions inside editable config as they can depend on $data
     //see https://github.com/vitalets/x-editable-yii/issues/40
     if (isset($options['htmlOptions']) && is_array($options['htmlOptions'])) {
         foreach ($options['htmlOptions'] as $k => $v) {
             if (is_string($v) && (strpos($v, '$data') !== false || strpos($v, '$row') !== false)) {
                 $options['htmlOptions'][$k] = $this->evaluateExpression($v, array('data' => $data, 'row' => $row));
             }
         }
     }
     //evaluate `params` as they can depend on $data
     //see https://github.com/vitalets/x-editable-yii/issues/65
     if (isset($options['params']) && is_array($options['params'])) {
         foreach ($options['params'] as $k => $v) {
             if (is_string($v) && (strpos($v, '$data') !== false || strpos($v, '$row') !== false)) {
                 $options['params'][$k] = $this->evaluateExpression($v, array('data' => $data, 'row' => $row));
             }
         }
     }
     $this->grid->controller->widget($widgetClass, $options);
 }
Beispiel #6
0
}
?>
<div class="row">
    <div class="span4">
        <?php 
$attributes = array(array('name' => 'username', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'url' => $this->createUrl('/user/admin/editableSaver'), 'attribute' => 'username'), true)));
$profileFields = ProfileField::model()->forOwner()->sort()->findAll();
if ($profileFields) {
    foreach ($profileFields as $field) {
        if ($field->varname != 'first_name' && $field->varname != 'last_name') {
            continue;
        }
        array_push($attributes, array('label' => UserModule::t($field->title), 'name' => $field->varname, 'type' => 'raw', 'value' => $field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname))));
    }
}
array_push($attributes, array('name' => 'email', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'url' => $this->createUrl('/user/admin/editableSaver'), 'attribute' => 'email'), true)), array('name' => 'status', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/user/admin/editableSaver'), 'source' => Editable::source(array(User::STATUS_ACTIVE => User::itemAlias("UserStatus", User::STATUS_ACTIVE), User::STATUS_NOACTIVE => User::itemAlias("UserStatus", User::STATUS_NOACTIVE))), 'attribute' => 'status'), true)));
$defaultDetailView = Yii::app()->getModule('user')->defaultDetailView;
$this->widget($defaultDetailView['path'], $defaultDetailView['options'] + array('data' => $model, 'attributes' => $attributes));
?>
        <div class="btn-toolbar pull-left">
            <div class="btn-group"><?php 
$this->widget("bootstrap.widgets.TbButton", array("icon" => "chevron-left", "size" => "large", "url" => isset($_GET["returnUrl"]) ? $_GET["returnUrl"] : array("{$this->id}/customerAdmin"), "htmlOptions" => array("class" => "search-button", "data-toggle" => "tooltip", "title" => UserModule::t("User List"))));
?>
</div>
        </div>        
    </div>
    <div class="span8">
    <?php 
$this->renderPartial($companies_view, array('model' => $model, 'ajax' => false));
?>
    </div>
Beispiel #7
0
 /**
  * Which fields to serialize
  * @return array
  */
 public function __sleep()
 {
     $fields = parent::__sleep() + array('disabled');
     return $fields;
 }
 public function actionGetAttributeName()
 {
     echo CJSON::encode(Editable::source(Attribute::model()->findAll(), 'id', function ($data) {
         return CHtml::encode($data->getName());
     }));
 }
<?php

/* @var $this ApplicationProjectMentorController */
/* @var $model ApplicationProjectMentor */
?>

<?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'user_id', 'status', 'date_created', 'max_amount', 'max_hours', 'system_pick_amount')));
?>

<hr>
<h4>Awaiting Approval</h4>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('summaryText' => '', 'dataProvider' => $model3, 'columns' => array('id', 'app_id', 'project_id', 'title', array('class' => 'editable.EditableColumn', 'name' => 'approval_status', 'header' => 'Approval Status', 'editable' => array('type' => 'select', 'url' => $this->createUrl('applicationProjectMentor/updatePick'), 'placement' => 'right', 'source' => Editable::source(array('Proposed by Mentor' => 'Proposed by Mentor', 'Approved' => 'Approved', 'Rejected' => 'Rejected')))))));
?>
<hr>
<h4>History</h4>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('summaryText' => '', 'dataProvider' => $model2, 'columns' => array('id', 'app_id', 'project_id', 'title', 'approval_status')));
Beispiel #10
0
$term = UserList::model()->getItemsForListCode('term');
$option_term = CHtml::listData($term, 'system_list_item_id', 'system_list_item_name');
echo '<div id="invoice-basic-info-container" class="lb_div_InvoiceInfo infoQuotation">';
echo '<table class="items table lb_table_InvoiceInfo">';
echo '<tbody>';
echo '<tr class="odd">';
echo '<th class="lb_th_InvoiceInfo">Date</th>';
echo '<td class="lb_td_InoviceInfo">';
$this->widget('editable.EditableField', array('type' => 'date', 'model' => $model, 'attribute' => 'lb_quotation_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'format' => 'yyyy-mm-dd', 'viewformat' => 'dd M yyyy'));
echo '</td>';
echo '</tr>';
echo '<tr class="odd">';
echo '<th class="lb_th_InvoiceInfo">Term</th>';
echo '<td class="lb_td_InoviceInfo">';
//echo $form->dropDownList($model,'lb_quotation_term',$option_term,array('empty'=>$model->lb_quotation_term,'name'=>'lb_quotation_term[]','style'=>'width:100px;'));
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_term', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => Editable::source(UserList::model()->getItemsForListCode('term'), 'system_list_item_id', 'system_list_item_name'), 'placement' => 'left'));
echo '</td>';
echo '</tr>';
echo '<tr class="odd">';
echo '<th class="lb_th_InvoiceInfo">Currency</th>';
echo '<td class="lb_td_InoviceInfo">';
// echo LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol;
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_currency', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'emptytext' => LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol, 'source' => CHtml::listData(LbGenera::model()->getCurrency("", LbGenera::LB_QUERY_RETURN_TYPE_MODELS_ARRAY), function ($gene) {
    return "{$gene->lb_record_primary_key}";
}, function ($gene) {
    return "{$gene->lb_genera_currency_symbol}";
}) + array("-1" => "-- Add new currency --"), 'placement' => 'left', 'htmlOptions' => array('id' => 'LbQuotation_quotation_genera_id_' . $model->lb_record_primary_key), 'onShown' => 'js: function() {
                            var $tip = $(this).data("editableContainer").tip();
                            var dropdown = $tip.find("select");
                            $(dropdown).bind("change", function(e){
                                onChangeCurrencyDropdown(e,' . $model->lb_record_primary_key . ');
Beispiel #11
0
			<?php 
    echo '<input type="hidden" class="opts" id="ProductOption_' . $i . '_option_id" name="ProductOption[' . $i . '][option_id]" value="' . $opt[0]->option_id . '"/>';
    ?>
			<?php 
    if ($optionModel->type == 'select' || $optionModel->type == 'radio' || $optionModel->type == 'checkbox') {
        $this->widget('bootstrap.widgets.TbGridView', array('type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => new CArrayDataProvider($opt[1]), 'columns' => array('id', array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'option_value_id', 'header' => Yii::t('label', 'Option Value'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'type' => 'select', 'emptytext' => Yii::t('info', 'Add Value'), 'title' => Yii::t('info', 'Enter Value'), 'source' => $this->createUrl('getOptionValue') . $opt[0]->option_id, 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "option_value_id", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'quantity', 'header' => Yii::t('label', 'Quantity'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'type' => 'text', 'emptytext' => Yii::t('info', 'Add Quantity'), 'title' => Yii::t('info', 'Enter Value'), 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "quantity", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'subtract', 'header' => Yii::t('label', 'Subtract'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'emptytext' => Yii::t('info', 'Subtract Stock'), 'title' => Yii::t('info', 'Subtract Stock'), 'type' => 'select', 'source' => Editable::source(array('0' => 'No', '1' => 'Yes')), 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "subtract", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'price_prefix', 'header' => Yii::t('label', 'Price Operator'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'emptytext' => Yii::t('info', 'Select Operator'), 'title' => Yii::t('info', 'Choose Operator'), 'type' => 'select', 'source' => Editable::source(array('1' => 'Add', '2' => 'Subtract')), 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "price_prefix", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'price', 'header' => Yii::t('label', 'Price'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'emptytext' => Yii::t('info', 'Add Price'), 'title' => Yii::t('info', 'Enter Price'), 'type' => 'text', 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "price", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'weight_prefix', 'header' => Yii::t('label', 'Weight Operator'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'emptytext' => Yii::t('info', 'Select Operator'), 'title' => Yii::t('info', 'Choose Operator'), 'type' => 'select', 'source' => Editable::source(array('1' => 'Add', '2' => 'Subtract')), 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "weight_prefix", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'common.extensions.editable.EditableColumn', 'name' => 'weight', 'header' => Yii::t('label', 'Weight'), 'parentModel' => array($i, 'ProductOption'), 'editable' => array('send' => 'never', 'emptytext' => Yii::t('info', 'Add Weight'), 'title' => Yii::t('info', 'Enter Weight'), 'type' => 'text', 'onSave' => 'js: function(e, params) {
											updateInput("ProductOptionValue", "weight", jQuery(this).parent(), params.newValue,["' . $i . '","ProductOption"]);
										}')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'htmlOptions' => array('style' => 'width: 20px'), 'buttons' => array('delete' => array('label' => Yii::t('label', 'Delete'), 'options' => array("class" => "doptval", 'title' => Yii::t('label', 'Delete')))), 'template' => ' {delete}'))));
    } else {
        if (in_array($optionModel->type, array('text', 'textarea', 'date', 'datetime'))) {
            ?>
				<div class="row-fluid">
				<br/>
			<?php 
            echo $form->labelEx($opt[0], 'option_value');
            ?>
			<?php 
            $this->widget('common.extensions.editable.Editable', array('type' => $optionModel->type, 'name' => "option_value", 'text' => $opt[0]->option_value, 'emptytext' => Yii::t('info', 'Add Option Value'), 'title' => Yii::t('info', 'Enter Option Value'), 'inputField' => array('type' => 'hidden', 'class' => "optvalinputoption_value", 'id' => "ProductOption_{$i}_option_value", 'name' => "ProductOption[{$i}][option_value]", 'value' => $opt[0]->option_value), 'send' => 'never', 'onSave' => 'js: function(e, params) {
								updateInput("ProductOption", "option_value", jQuery(this).parent(), params.newValue );
Beispiel #12
0
<?php

$this->setPageTitle(Yii::t('TrucksModule.model', 'Vtdt Truck Doc Types') . ' - ' . Yii::t('TrucksModule.crud_static', 'Manage'));
$create_button = $this->widget("bootstrap.widgets.TbButton", array("label" => Yii::t("TrucksModule.crud_static", "Create"), "icon" => "icon-plus", "size" => "large", "type" => "success", "url" => array("create"), "visible" => Yii::app()->user->checkAccess("Trucks.VtdtTruckDocType.*") || Yii::app()->user->checkAccess("Trucks.VtdtTruckDocType.Create")), TRUE);
?>

    <h1>
        <?php 
echo $create_button;
?>
        <?php 
echo Yii::t('TrucksModule.model', 'Vtdt Truck Doc Types Manage');
?>
    </h1>

<?php 
Yii::beginProfile('VtdtTruckDocType.view.grid');
?>

<?php 
$this->widget('TbGridView', array('id' => 'vtdt-truck-doc-type-grid', 'dataProvider' => $model->search(), 'template' => '{items}', 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'vtdt_name', 'editable' => array('url' => $this->createUrl('/trucks/vtdtTruckDocType/editableSaver'), 'placement' => 'right')), array('class' => 'editable.EditableColumn', 'name' => 'vtdt_hidded', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/trucks/vtdtTruckDocType/editableSaver'), 'source' => Editable::source(array(0 => Yii::t('TrucksModule.model', 'Active'), 1 => Yii::t('TrucksModule.model', 'Hidded'))))), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'Yii::app()->user->checkAccess("Trucks.VtdtTruckDocType.Update")'), 'delete' => array('visible' => 'Yii::app()->user->checkAccess("Trucks.VtdtTruckDocType.Delete")')), 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("vtdt_id" => $data->vtdt_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("vtdt_id" => $data->vtdt_id))'))));
Yii::endProfile('VtdtTruckDocType.view.grid');
Beispiel #13
0
}
$this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => $this->createUrl('uploadLogo', array('id' => $model->lb_record_primary_key, 'sub_cription' => $subcription, 'company_id' => $company)), 'allowedExtensions' => array("jpeg", "jpg", "gif", "png"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 1 * 1024, 'multiple' => true, 'onComplete' => "js:function(id, fileName, responseJSON){\n                                    \$('#uploadFile .qq-upload-list').html('');\n                                    //\$('#logo_wrapper img').attr('src','" . $path . "'+fileName);\n                                    window,location.reload(true);\n                               }")));
echo '</div>';
//echo '<h3 id="po-number-container">'.$model->getDisplayPOStatus($model->lb_vendor_status).'</h3>';
echo '<div id="invoice-basic-info-container" style="float: left;width:36%;">';
echo '<h3 id="po-number-container">' . $model->lb_vendor_no . '</h3><br />';
//date
echo Yii::t('lang', 'PO Date') . ': ';
$this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vendor_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right'));
echo '&nbsp;';
echo Yii::t('lang', 'Due Date') . ': ';
$this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vendor_due_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right'));
echo '<br>';
echo '<div>';
echo Yii::t('lang', 'Status') . ': ';
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_vendor_status', 'htmlOptions' => array('id' => 'lb_invocie_status'), 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => Editable::source(array(LbVendor::LB_PO_STATUS_CODE_DRAFT => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_DRAFT), LbVendor::LB_PO_STATUS_CODE_APPROVED => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_APPROVED), LbVendor::LB_PO_STATUS_CODE_SEND => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_SEND), LbVendor::LB_PO_STATUS_CODE_ACCEPTED => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_ACCEPTED), LbVendor::LB_PO_STATUS_CODE_REJECTED => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_REJECTED))), 'placement' => 'right', 'validate' => 'js: function(value) {
                        if(quotation_status_draft) 
                            return "Please confirm quotation.";
                        else if(value=="' . LbVendor::LB_PO_STATUS_CODE_DRAFT . '")
                            return "You\'re not allowed to update the status of this quotation back to Draft";
                   }', 'success' => 'js: function(response, newValue) {
        if(newValue == "' . LbVendor::LB_PO_STATUS_CODE_ACCEPTED . '")
        {
            quotaiton_status_accepted = true;
        }
        else
        {
            quotaiton_status_accepted = false;
        }
        $("#lb_invocie_status").html(newValue);
    }'));
 public function actionGetOptionValue($id)
 {
     echo CJSON::encode(Editable::source(OptionValue::model()->findAll('option_id=:option_id', array(':option_id' => $id), 'id', 'function($data){return $data->getName;}')));
 }
Beispiel #15
0
<?php

$this->setPageTitle(Yii::t('TrucksModule.model', 'Vsrv Services') . ' - ' . Yii::t('TrucksModule.crud_static', 'Manage'));
?>

    <h1>
        <?php 
$this->widget("bootstrap.widgets.TbButton", array("label" => Yii::t("TrucksModule.crud_static", "Create"), "icon" => "icon-plus", "size" => "large", "type" => "success", "url" => array("create"), "visible" => Yii::app()->user->checkAccess("Trucks.VsrvServices.*") || Yii::app()->user->checkAccess("Trucks.VsrvServices.Create")));
?>
        <i class="icon-wrench"></i>  
        <?php 
echo Yii::t('TrucksModule.model', 'Vsrv Services Manage');
?>
    </h1>

<?php 
Yii::beginProfile('VsrvServices.view.grid');
?>


<?php 
$this->widget('TbGridView', array('id' => 'vsrv-services-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{pager}{items}{pager}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'vsrv_name', 'editable' => array('url' => $this->createUrl('/trucks/vsrvServices/editableSaver'), 'placement' => 'right')), array('class' => 'editable.EditableColumn', 'name' => 'vsrv_hidded', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/trucks/vsrvServices/editableSaver'), 'source' => Editable::source(array(0 => Yii::t('TrucksModule.model', 'Active'), 1 => Yii::t('TrucksModule.model', 'Hidded'))))), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'Yii::app()->user->checkAccess("Trucks.VsrvServices.Update")'), 'delete' => array('visible' => 'Yii::app()->user->checkAccess("Trucks.VsrvServices.Delete")')), 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("vsrv_id" => $data->vsrv_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("vsrv_id" => $data->vsrv_id))', 'updateButtonOptions' => array('data-toggle' => 'tooltip'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip')))));
Yii::endProfile('VsrvServices.view.grid');
/* @var $this ApplicationDomainMentorController */
/* @var $model ApplicationDomainMentor */
/* @var $domainHistory  */
/* @var $domainChanges  */
/* @var $subdomainHistory  */
/* @var $subdomainChanges  */
?>

<?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'user_id', 'status', 'date_created', 'max_amount', 'max_hours')));
?>
<hr>
<h4>Domain Picks</h4>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'domain_picks', 'summaryText' => '', 'dataProvider' => $domainChanges, 'columns' => array('id', 'app_id', 'proficiency', 'domain_id', array('class' => 'editable.EditableColumn', 'name' => 'approval_status', 'header' => 'Approval Status', 'editable' => array('type' => 'select', 'url' => $this->createUrl('applicationDomainMentor/updateDomainPick'), 'placement' => 'right', 'source' => Editable::source(array('Proposed by Mentor' => 'Proposed by Mentor', 'Approved' => 'Approved', 'Rejected' => 'Rejected')))))));
?>
<hr>
<h5>History</h5>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'domain_picks', 'summaryText' => '', 'dataProvider' => $domainHistory, 'columns' => array('id', 'app_id', 'proficiency', 'domain_id', 'approval_status')));
?>
<h4>Sub-Domain Picks</h4>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'personal_picks', 'summaryText' => '', 'dataProvider' => $subdomainChanges, 'columns' => array('id', 'app_id', 'proficiency', 'subdomain_id', array('class' => 'editable.EditableColumn', 'name' => 'approval_status', 'header' => 'Approval Status', 'editable' => array('type' => 'select', 'url' => $this->createUrl('applicationDomainMentor/updateSubdomainPick'), 'placement' => 'right', 'source' => Editable::source(array('Proposed by Mentor' => 'Proposed by Mentor', 'Approved' => 'Approved', 'Rejected' => 'Rejected')))))));
?>
<h5>History</h5>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'domain_picks', 'summaryText' => '', 'dataProvider' => $subdomainHistory, 'columns' => array('id', 'app_id', 'proficiency', 'subdomain_id', 'approval_status')));
?>

Beispiel #17
0
echo '</div>';
// Quotation number, date and due
echo '<div id="quotation-basic-info-container" style="float: left;width:36%;">';
echo '<h3 id="quotation-number-container">';
echo $model->lb_quotation_no;
// SHALL NOT ALLOW UPDATING OF INVOICE NO
echo '</h3><br/>';
echo Yii::t('lang', 'Quotation Date') . ': ';
$this->widget('editable.EditableField', array('type' => 'date', 'model' => $model, 'attribute' => 'lb_quotation_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'format' => 'yyyy-mm-dd', 'viewformat' => 'dd/mm/yyyy'));
echo '&nbsp;&nbsp;';
echo Yii::t('lang', 'Due Date') . ': ';
$this->widget('editable.EditableField', array('type' => 'date', 'model' => $model, 'attribute' => 'lb_quotation_due_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'format' => 'yyyy-mm-dd', 'viewformat' => 'dd/mm/yyyy'));
echo '<br>';
echo '<div id="quotation_status">';
echo Yii::t('lang', 'Status') . ': ';
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_status', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => Editable::source(array(LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT), LbQuotation::LB_QUOTATION_STATUS_CODE_APPROVED => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_APPROVED), LbQuotation::LB_QUOTATION_STATUS_CODE_SENT => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_SENT), LbQuotation::LB_QUOTATION_STATUS_CODE_ACCEPTED => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_ACCEPTED), LbQuotation::LB_QUOTATION_STATUS_CODE_REJECTED => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_REJECTED))), 'placement' => 'right', 'validate' => 'js: function(value) {
                        if(quotation_status_draft) 
                            return "Please confirm quotation.";
                        else if(value=="' . LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT . '")
                            return "You\'re not allowed to update the status of this quotation back to Draft";
                   }', 'success' => 'js: function(response, newValue) {
        if(newValue == "' . LbQuotation::LB_QUOTATION_STATUS_CODE_ACCEPTED . '")
        {
            quotaiton_status_accepted = true;
        }
        else
        {
            quotaiton_status_accepted = false;
        }
        $("#quotation_status_container").html(newValue);
    }'));
 protected function renderDataCellContent($row, $data)
 {
     $isModel = $data instanceof CModel;
     if ($isModel) {
         $widgetClass = 'EditableField';
         $options = array('model' => $data, 'attribute' => $this->name);
         //manually make selector non unique to match all cells in column
         $selector = $this->grid->id . '_' . str_replace('\\', '_', get_class($data)) . '_' . $this->name;
         //flag to pass text to widget
         $passText = strlen($this->value);
     } else {
         $widgetClass = 'Editable';
         $options = array('pk' => $data[$this->grid->dataProvider->keyField], 'name' => $this->name);
         //manually make selector non unique to match all cells in column
         $selector = $this->grid->id . '_' . $this->name;
         $passText = true;
         //if autotext will be applied, do not pass text param
         if (!strlen($this->value) && Editable::isAutotext($this->editable, isset($this->editable['type']) ? $this->editable['type'] : '')) {
             $options['value'] = $data[$this->name];
             $passText = false;
         }
     }
     $options = CMap::mergeArray($this->editable, $options);
     //if value defined for column --> use it as element text
     if ($passText) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $options['text'] = $text;
         $options['encode'] = false;
     }
     //apply may be a string expression, see https://github.com/vitalets/x-editable-yii/issues/33
     if (isset($options['apply']) && is_string($options['apply'])) {
         $options['apply'] = $this->evaluateExpression($options['apply'], array('data' => $data, 'row' => $row));
     }
     $widget = $this->grid->controller->createWidget($widgetClass, $options);
     //if editable not applied --> render original text
     if ($widget->apply === false) {
         if (isset($text)) {
             echo $text;
         } else {
             parent::renderDataCellContent($row, $data);
         }
         return;
     }
     //call these methods manually as we don't call run()
     $widget->buildHtmlOptions();
     $widget->buildJsOptions();
     $widget->registerAssets();
     //manually make selector non unique to match all cells in column
     //model class may be namespaced, see https://github.com/vitalets/x-editable-yii/issues/9
     $widget->htmlOptions['rel'] = $selector;
     //can't call run() as it registers clientScript
     $widget->renderLink();
     //manually render client script (one for all cells in column)
     if (!$this->_isScriptRendered) {
         $script = $widget->registerClientScript();
         //use parent() as grid is totally replaced by new content
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $selector . '-event', '
             $("#' . $this->grid->id . '").parent().on("ajaxUpdate.yiiGridView", "#' . $this->grid->id . '", function() {' . $script . '});
         ');
         $this->_isScriptRendered = true;
     }
 }
<h3><?php 
    echo CHtml::link('Domain Mentor', '#', array('class' => 'domain-button'));
    ?>
</h3>
<hr>
<?php 
    $maxTickets = Yii::app()->db->createCommand()->select('max_tickets')->from('domain_mentor')->where('user_id=:id', array(':id' => $model->id))->queryScalar();
    if ($maxTickets === null || $maxTickets === false) {
        $maxTickets = 'Not Set';
    }
    echo 'Maximum Tickets: ' . $maxTickets;
    ?>
<br/>
<?php 
    $ratings = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    $this->widget('bootstrap.widgets.TbGridView', array('type' => 'striped condensed hover', 'id' => 'id', 'dataProvider' => new CArrayDataProvider($model->userDomains, array('keyField' => 'id')), 'summaryText' => '', 'columns' => array(array('name' => 'id', 'value' => '$data->id', 'header' => 'ID'), array('name' => 'domain.name', 'value' => '$data->domain->name', 'header' => 'Domain'), array('name' => 'subdomain.name', 'value' => '$data->getSubdomain()', 'header' => 'Sub-Domain'), array('class' => 'editable.EditableColumn', 'name' => 'rate', 'header' => 'Rate', 'editable' => array('type' => 'select', 'url' => $this->createUrl('userdomain/updateUser'), 'source' => Editable::source($ratings), 'inputclass' => 'input-mini', 'placement' => 'left')), array('class' => 'editable.EditableColumn', 'name' => 'tier_team', 'header' => 'Tier', 'editable' => array('type' => 'select', 'url' => $this->createUrl('userdomain/updateUser'), 'source' => Editable::source(array(1 => '1', 2 => '2')), 'inputclass' => 'input-mini', 'placement' => 'left')))));
    ?>
</div>	
<?php 
}
?>
<!-- DOMAIN MENTOR END -->



<!-- TICKETS START -->
<div class='well tickets-form' style="display:">
	<h3><?php 
echo CHtml::link('Tickets', '#', array('class' => 'tickets-button'));
?>
</h3>
         $level=Yii::t('courses', '0235');
         $rate = 4;
         break;
     case 'senior':
         $level=Yii::t('courses', '0236');
         $rate = 5;
         break;
 }
 $this->widget('editable.EditableField', array(
     'type'      => 'select',
     'model'     => $post,
     'attribute' => 'level',
     'url'       => $this->createUrl('module/updateModuleAttribute'),
     //    'source'    => Editable::source(Status::model()->findAll(), 'status_id', 'status_text'),
     //or you can use plain arrays:
     'source'    => Editable::source(array('intern'=> Yii::t('courses', '0232'), 'junior' => Yii::t('courses', '0233'),'strong junior' => Yii::t('courses', '0234'), 'middle' => Yii::t('courses', '0235'), 'senior' => Yii::t('courses', '0236'))),
     'placement' => 'right',
 ));
 ?>
 <div class="ratico">
     <?php
     for ($i=0; $i<$rate; $i++)
     {
         ?><span>
         <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'ratIco1.png'); ?>"/>
         </span><?php
     }
     for ($i=$rate; $i<5; $i++)
     {
         ?><span>
         <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'ratIco0.png'); ?>"/>
 public function getSelector()
 {
     return str_replace('\\', '_', get_class($this->staticModel)) . '_' . parent::getSelector();
 }
Beispiel #22
0
    echo $model->user_agent;
    echo Html::tag('br');
}
?>
            </div>
        </div>
    </div>
    <div class="col-xs-12 col-md-4 col-lg-4">
        <div class="panel panel-default height">
            <div class="panel-heading">Payment Information</div>
            <div class="panel-body">
                <?php 
if (in_array('payment_status_id', $subData['visibleAttributes'])) {
    echo Html::tag('strong', $model->getAttributeLabel('payment_status_id') . ': ');
    echo Editable::widget(['model' => $model, 'attribute' => 'payment_status_id', 'displayValueConfig' => $subData['paymentStatusesHtml'], 'data' => $subData['paymentStatusesList'], 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'options' => ['class' => 'form-control'], 'editableValueOptions' => ['class' => 'text-danger'], 'size' => 'md', 'formOptions' => ['action' => Url::toRoute('order/editable')], 'afterInput' => function ($form, $widget) {
        echo $form->field($widget->model, 'order_id')->hiddenInput()->label(false);
    }]);
    echo Html::tag('br');
}
?>
                <?php 
if (in_array('payment_method_id', $subData['visibleAttributes'])) {
    echo Html::tag('strong', $model->getAttributeLabel('payment_method_id') . ': ');
    echo $model->paymentMethod->name;
    echo Html::tag('br');
}
?>
                <?php 
if (in_array('payment_text', $subData['visibleAttributes'])) {
    echo Html::tag('strong', $model->getAttributeLabel('payment_text') . ': ');
    echo Yii::$app->formatter->asNtext($model->payment_text);