本文整理汇总了PHP中Status::genSubgridVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::genSubgridVariables方法的具体用法?PHP Status::genSubgridVariables怎么用?PHP Status::genSubgridVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::genSubgridVariables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBreadcrumb
protected function getBreadcrumb()
{
$depth = Status::depth($this->statusVariables);
if ($depth <= 1) {
return array();
}
$breadcrumb = array();
$gridConfig = $this->config;
$breadcrumb[] = array('title' => $gridConfig->getTitle(), 'url' => '#');
$lastStatusVariables = array();
$db = new Db($this->config, $this->statusVariables);
for ($i = 1; $i <= $depth - 1; $i++) {
if (isset($this->statusVariables['gridParentId' . $i])) {
$parentId = $this->statusVariables['gridParentId' . $i];
} else {
$parentId = null;
}
if (isset($this->statusVariables['gridId' . $i])) {
$gridId = $this->statusVariables['gridId' . $i];
} else {
$gridId = null;
}
$lastStatusVariables = Status::genSubgridVariables($lastStatusVariables, $gridId, $parentId);
$tmpGridConfig = $gridConfig->subgridConfig($lastStatusVariables);
$hash = Status::build($lastStatusVariables);
$breadcrumbGridconfig = $gridConfig->subgridConfig($lastStatusVariables, $i);
if ($breadcrumbGridconfig->getBreadcrumbField()) {
$title = $db->breadcrumbTitle($i);
} else {
$title = $tmpGridConfig->getTitle();
}
$breadcrumb[] = array('title' => $title, 'url' => '#' . $hash);
}
return $breadcrumb;
}
示例2: delete
public function delete($id)
{
$db = new Db($this->subgridConfig, $this->statusVariables);
$fields = $this->subgridConfig->fields();
$curData = $db->fetchRow($id);
foreach ($fields as $field) {
$fieldObject = $this->subgridConfig->fieldObject($field);
$fieldObject->beforeDelete($id, $curData);
}
$sql = "\n DELETE\n " . $this->subgridConfig->tableName() . "\n FROM\n " . $this->subgridConfig->tableName() . "\n " . $db->joinQuery() . "\n WHERE\n " . $this->subgridConfig->tableName() . ".`" . $this->subgridConfig->idField() . "` = :id\n ";
$params = array('id' => $id);
$callables = $this->subgridConfig->beforeDelete();
if ($callables) {
if (is_array($callables) && !is_callable($callables)) {
foreach ($callables as $callable) {
call_user_func($callable, $params['id']);
}
} else {
call_user_func($callables, $params['id']);
}
}
ipDb()->execute($sql, $params);
if ($this->subgridConfig->isMultilingual()) {
$sql = "\n DELETE\n\n FROM\n " . $this->subgridConfig->languageTableName() . "\n WHERE\n " . $this->subgridConfig->languageTableName() . ".`" . $this->subgridConfig->languageForeignKeyField() . "` = :id\n ";
ipDb()->execute($sql, $params);
}
$callables = $this->subgridConfig->afterDelete();
if ($callables) {
if (is_array($callables) && !is_callable($callables)) {
foreach ($callables as $callable) {
call_user_func($callable, $params['id']);
}
} else {
call_user_func($callables, $params['id']);
}
}
//remove records in child grids
foreach ($fields as $field) {
$fieldObject = $this->subgridConfig->fieldObject($field);
$fieldObject->afterDelete($id, $curData);
if ($field['type'] == 'Grid') {
$childStatusVariables = Status::genSubgridVariables($this->statusVariables, $field['gridId'], $id);
$subActions = new Actions(new Config($field['config']), $childStatusVariables);
$childConfig = new Config($field['config']);
$db = new Db($childConfig, $childStatusVariables);
$where = $db->buildSqlWhere();
$sql = "\n SELECT\n `" . $childConfig->idField() . "`\n FROM\n " . $childConfig->tableName() . "\n WHERE\n {$where}\n ";
$idsToDelete = ipDb()->fetchColumn($sql);
foreach ($idsToDelete as $idToDelete) {
$subActions->delete($idToDelete);
}
}
}
}
示例3: subgrid
protected function subgrid($params)
{
if (empty($params['gridId'])) {
throw new \Ip\Exception('girdId GET variable missing');
}
if (empty($params['gridParentId'])) {
throw new \Ip\Exception('girdParentId GET variable missing');
}
$newStatusVariables = Status::genSubgridVariables($this->statusVariables, $params['gridId'], $params['gridParentId']);
$commands[] = Commands::setHash(Status::build($newStatusVariables));
return $commands;
}