本文整理汇总了PHP中CGridColumn类的典型用法代码示例。如果您正苦于以下问题:PHP CGridColumn类的具体用法?PHP CGridColumn怎么用?PHP CGridColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGridColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDataCell
/**
* A seam for people extending CGridView to be able to hook onto the data cell rendering process.
*
* By overriding only this method we will not need to copypaste and modify the whole entirety of `renderTableRow`.
* Or override `renderDataCell()` method of all possible CGridColumn descendants.
*
* @param CGridColumn $column The Column instance to
* @param integer $row
* @since 1.1.17
*/
protected function renderDataCell($column, $row)
{
$column->renderDataCell($row);
}
示例2: getRenderedDataCellValue
/**
* @param CGridColumn $column
* @param integer $row
*
* @return string
*/
private function getRenderedDataCellValue($column, $row)
{
ob_start();
$column->renderDataCell($row);
return ob_get_clean();
}
示例3: renderHeaderCellContent
protected function renderHeaderCellContent()
{
CGridColumn::renderHeaderCellContent();
}
示例4: renderFooterCell
/**
* Override to handle spanning of row. Used primarily by matrix reports to render a grid
*/
public function renderFooterCell()
{
if (isset($this->footer)) {
return parent::renderFooterCell();
}
return null;
}
示例5: renderHeaderCellContent
/**
* Renders the header cell content.
* This method will render a link that can trigger the sorting if the column is sortable.
*/
protected function renderHeaderCellContent()
{
if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
echo $this->grid->dataProvider->getSort()->link($this->name, $this->header);
} else {
parent::renderHeaderCellContent();
}
}
示例6: getDataCellContent
public function getDataCellContent($row)
{
if (method_exists(get_parent_class($this), 'getDataCellContent')) {
return parent::getDataCellContent($row);
}
ob_start();
$this->renderDataCellContent($row, $this->grid->dataProvider->data[$row]);
return ob_get_clean();
}
示例7: 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);
}
示例8: renderHeaderCellContent
/**
* Renders the header cell content.
* This method will render a link that can trigger the sorting if the column is sortable.
*/
protected function renderHeaderCellContent()
{
if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
echo $this->grid->dataProvider->getSort()->link($this->name, $this->header, array('class' => 'sort-link'));
} elseif ($this->name !== null && $this->header === null) {
if ($this->grid->dataProvider instanceof CActiveDataProvider) {
echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
} else {
echo CHtml::encode($this->name);
}
} else {
parent::renderHeaderCellContent();
}
}
示例9: renderHeaderCellContent
/**
* Renders the header cell content.
* This method will render a checkbox in the header when {@link CGridView::selectableRows} is greater than 1.
*/
protected function renderHeaderCellContent()
{
if ($this->grid->selectableRows > 1) {
echo CHtml::checkBox($this->id . '_all', false);
} else {
parent::renderHeaderCellContent();
}
}
示例10: init
public function init()
{
parent::init();
}
示例11: renderFilterCellContent
/**
* Renders the filter cell content.
* This method will render the {@link filter} as is if it is a string.
* If {@link filter} is an array, it is assumed to be a list of options, and a dropdown selector will be rendered.
* Otherwise if {@link filter} is not false, a text field is rendered.
* @since 1.1.1
*/
protected function renderFilterCellContent()
{
if ($this->filter !== null) {
if (is_string($this->filter)) {
echo $this->filter;
} else {
if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
if (is_array($this->filter)) {
echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => ''));
} else {
if ($this->filter === null) {
echo CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false));
}
}
} else {
parent::renderFilterCellContent();
}
}
}
}
示例12: renderHeaderCellContent
/**
* Render header cell (can not be sortable)
*/
protected function renderHeaderCellContent()
{
if ($this->name !== null && $this->header === null) {
if ($this->grid->dataProvider instanceof CActiveDataProvider) {
echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
} else {
echo CHtml::encode($this->name);
}
} else {
parent::renderHeaderCellContent();
}
}
示例13: 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);
*/
}
}
示例14: renderHeaderCellContent
/**
* Renders the header cell content.
* This method will render a checkbox in the header when {@link selectableRows} is greater than 1
* or in case {@link selectableRows} is null when {@link CGridView::selectableRows} is greater than 1.
*/
protected function renderHeaderCellContent()
{
if (trim($this->headerTemplate) === '') {
echo $this->grid->blankDisplay;
return;
}
$item = '';
if ($this->selectableRows === null && $this->grid->selectableRows > 1) {
$item = CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all'));
} elseif ($this->selectableRows > 1) {
$item = CHtml::checkBox($this->id . '_all', false);
} else {
ob_start();
parent::renderHeaderCellContent();
$item = ob_get_clean();
}
echo strtr($this->headerTemplate, array('{item}' => $item));
}
示例15: getHeaderCellContent
/**
* Returns the header cell content.
* This method will render a checkbox in the header when {@link selectableRows} is greater than 1
* or in case {@link selectableRows} is null when {@link CGridView::selectableRows} is greater than 1.
* @return string the header cell content.
* @since 1.1.16
*/
public function getHeaderCellContent()
{
if (trim($this->headerTemplate) === '') {
return $this->grid->blankDisplay;
}
if ($this->selectableRows === null && $this->grid->selectableRows > 1) {
$item = CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all'));
} elseif ($this->selectableRows > 1) {
$item = CHtml::checkBox($this->id . '_all', false);
} else {
$item = parent::getHeaderCellContent();
}
return strtr($this->headerTemplate, array('{item}' => $item));
}