本文整理汇总了PHP中CGridColumn::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CGridColumn::init方法的具体用法?PHP CGridColumn::init怎么用?PHP CGridColumn::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGridColumn
的用法示例。
在下文中一共展示了CGridColumn::init方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the column.
*/
public function init()
{
parent::init();
if ($this->dataField === null) {
$this->sortable = false;
}
}
示例2: init
/**
* Initializes the column.
*/
public function init()
{
parent::init();
if ($this->name === null && $this->value === null) {
throw new CException(Yii::t('zii', 'Either "name" or "value" must be specified for CEditableColumn.'));
}
}
示例3: init
public function init()
{
parent::init();
if ($this->name === null) {
throw new CException(Yii::t('zii', '"name" must be specified for SelectColumn.'));
}
}
示例4: init
public function init()
{
parent::init();
$data = $this->grid->dataProvider->getData();
if (count($data) == 0) {
return;
}
$this->link = ObjectUrlRule::createUrlFromCurrent(BackendModule::ROUTE_INSTANCE_LIST, array(ObjectUrlRule::PARAM_OBJECT_PARENT => '{id}'), array(ObjectUrlRule::PARAM_SYSTEM_MODULE, ObjectUrlRule::PARAM_PAGER_NUM, ObjectUrlRule::PARAM_OBJECT_INSTANCE, ObjectUrlRule::PARAM_ACTION_VIEW));
$this->countData = $this->grid->dataProvider->model->getCountChildOfInstances($data);
}
示例5: init
public function init()
{
parent::init();
if ($this->pathPrefix === null) {
$this->pathPrefix = Yii::app()->baseUrl . '/uploads/';
}
if ($this->name === null) {
throw new CException(Yii::t('zii', 'Please specify a name for EImageColumn.'));
}
}
示例6: init
/**
* @throws CException
*/
public function init()
{
parent::init();
if (empty($this->name)) {
$this->sortable = false;
}
if (empty($this->onImageUrl)) {
$this->onImageUrl = Yii::app()->request->baseUrl . '/core/images/admin/yes.png';
}
if (empty($this->offImageUrl)) {
$this->offImageUrl = Yii::app()->request->baseUrl . '/core/images/admin/no.png';
}
if (empty($this->name) && empty($this->value)) {
throw new CException('Either "name" or "value" must be specified for DToggleColumn.');
}
$this->registerClientScript();
}
示例7: init
public function init()
{
parent::init();
$cs = Yii::app()->getClientScript();
$gridId = $this->grid->getId();
$script = <<<SCRIPT
\t\tjQuery(document).on("click", ".{$this->_flagClass}", function(e){
\t\t\te.preventDefault();
\t\t\tvar link = this;
\t\t\t\$.ajax({
\t\t\t\tdataType: "json",
\t\t\t\tcache: false,
\t\t\t\turl: link.href,
\t\t\t\tsuccess: function(data){
\t\t\t\t\t\$('#{$gridId}').yiiGridView.update('{$gridId}');
\t\t\t\t}
\t\t\t});
\t\t});
SCRIPT;
$cs->registerScript(__CLASS__ . $gridId . '#flag_link', $script);
}
示例8: init
public function init()
{
parent::init();
$cs = Yii::app()->getClientScript();
$gridId = $this->grid->getId();
/*
$script = <<<SCRIPT
jQuery(document).on("click", ".{$this->_flagClass}", function(e) {e.preventDefault();
var link = this;
$.ajax({
dataType: "json",
cache: false,
url: link.href,
success: function(data){
$('#$gridId').yiiGridView.update('$gridId');
}
});
});
SCRIPT;
$cs-> registerScript(__CLASS__.$gridId.'#flag_link', $script);
*/
}
示例9: init
public function init()
{
parent::init();
if ($this->icons) {
$this->_assets = Yii::app()->assetManager->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
}
$cs = Yii::app()->getClientScript();
$gridId = $this->grid->getId();
$script = <<<SCRIPT
\t\tjQuery(".{$this->_flagClass}").live("click", function(e){
\t\t\te.preventDefault();
\t\t\tvar link = this;
\t\t\t\$.ajax({
\t\t\t\tdataType: "json",
\t\t\t\tcache: false,
\t\t\t\turl: link.href,
\t\t\t\tsuccess: function(data){
\t\t\t\t\t\$('#{$gridId}').yiiGridView.update('{$gridId}');
\t\t\t\t}
\t\t\t});
\t\t});
SCRIPT;
$cs->registerScript(__CLASS__ . $gridId . '#flag_link', $script);
}
示例10: init
public function init()
{
parent::init();
}
示例11: init
public function init()
{
parent::init();
$arrayOfId = $this->grid->dataProvider->getKeys();
if (count($arrayOfId) == 0) {
return;
}
$availableObjects = array();
$singleStatus = 0;
foreach ($this->childData as $param) {
if ($param->isRelation() == false) {
continue;
}
$idObject = $param->getIdObjectParameter();
// Смотрим, может ли пользователь работать с подчинённым объектом
if (isset($availableObjects[$idObject]) && $availableObjects[$idObject] === null) {
continue;
}
if (!Yii::app()->authManager->checkObject(DaDbAuthManager::OPERATION_LIST, Yii::app()->user->id, $idObject)) {
$availableObjects[$idObject] = null;
continue;
} else {
$singleStatus = $singleStatus == 0 ? 1 : 2;
$availableObjects[$idObject][$param->getIdParameter()]['field'] = $param->getFieldName();
}
}
if ($singleStatus == 2) {
$this->single = false;
$this->htmlOptions = array('class' => 'col-ref action-sub-data');
} else {
$this->htmlOptions = array('class' => 'col-ref-one action-sub-data');
}
foreach ($availableObjects as $idObject => $params) {
if ($params === null) {
unset($availableObjects[$idObject]);
continue;
}
$object = null;
if (count($params) == 1) {
$object = DaObject::getById($idObject, false);
foreach ($params as $idParameter => $caption) {
$availableObjects[$idObject][$idParameter]['caption'] = $object->name;
}
} else {
$object = DaObject::getById($idObject, true);
foreach ($params as $idParameter => $caption) {
$param = $object->getParameterObjectByIdParameter($idParameter);
$availableObjects[$idObject][$idParameter]['caption'] = $object->name . ' (' . $param->caption . ')';
}
}
$model = $object->getModel();
foreach ($params as $idParameter => $config) {
$cr = new CDbCriteria();
$cr->addColumnCondition(array('t.id_object' => $idObject));
$cr->order = 't.order_no';
$objectView = DaObjectView::model()->find($cr);
$dataProvider = Yii::app()->controller->buildDataProvider($objectView, $model);
$where = $dataProvider->criteria->condition;
$params = $dataProvider->criteria->params;
$whereConfig = array('and');
if ($where != null) {
$whereConfig[] = $where;
}
$whereConfig[] = array('in', $config['field'], $arrayOfId);
$data = Yii::app()->db->createCommand()->select($config['field'] . ' AS id, count(*) AS cnt')->from($model->tableName())->where($whereConfig, $params)->group($config['field'])->queryAll();
/*
// многообъектая поддержка
$iq = new InstanceQuery($where);
$arrayOfIdObject = Object::getCommonObjectBySingle($idObjectTmp);
if (count($arrayOfIdObject) > 1) {
$iq->setUsedObjects(array($idObjectTmp));
}*/
$assocData = array();
foreach ($data as $row) {
$assocData[$row['id']] = $row['cnt'];
}
$availableObjects[$idObject][$idParameter]['data'] = $assocData;
}
}
$this->prepareData = $availableObjects;
// TODO: Поменять скрипт, когда будет применяться PopOver
if (!$this->single) {
Yii::app()->clientScript->registerScript('admin.subData.init', '$(".action-sub-data").daSubData();
$(document).on("afterGridUpdate", function(e) { $(".action-sub-data").daSubData(); });
', CClientScript::POS_READY);
/*
Yii::app()->clientScript->registerScript('admin.subData.init', '
$("[rel=\'popover-sub-data\']").popover({
placement: "left",
trigger: "hover",
template: "<div class=\'popover\'><div class=\'arrow\'></div><div class=\'popover-inner\'><div class=\'popover-content\'></div></div></div>"
});', CClientScript::POS_READY);
*/
}
}
示例12: init
/**
* Init column
* Publish necessary client script.
*/
public function init()
{
parent::init();
$this->publishReorderColumnAssets();
$this->registerReorderColumnClientScript();
}