本文整理汇总了PHP中I2CE_FormStorage::isWritable方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_FormStorage::isWritable方法的具体用法?PHP I2CE_FormStorage::isWritable怎么用?PHP I2CE_FormStorage::isWritable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE_FormStorage
的用法示例。
在下文中一共展示了I2CE_FormStorage::isWritable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
/**
* Perform the main actions of the page.
*/
protected function action()
{
parent::action();
$this->list->populate();
$this->template->setDisplayData("type_name", $this->list->getDisplayName());
$this->template->setDisplayData("list_name", $this->list->name());
if ($this->request_exists('i2ce_template')) {
$template_alt = $this->request('i2ce_template');
} else {
$template_alt = '';
}
$viewNode = $this->template->addFile($this->list->getViewTemplate($template_alt));
$this->template->setDisplayData("list_view_link", "type=" . $this->type);
$this->template->setDisplayData("list_edit_link", "type=" . $this->type . "&id=" . $this->id);
$this->template->setAttribute("task", "can_edit_database_list_" . $this->type, "list_edit_link_node");
$editNode = $this->template->getElementById("list_edit_link_node", $viewNode);
if (!$editNode instanceof DOMNode) {
// No edit node so add it to the can_edit task for the li in this dom.
// The auto list page is handling this better, but this is just a stopgap measure
// to remove the main link when the form isn't writable.
$editSearch = $this->template->query("./descendant-or-self::div[@class='editRecord']/ul/li[@task='can_edit_database_list_" . $this->type . "']", $viewNode);
if ($editSearch->length > 0) {
$editSearch->item(0)->setAttribute("id", "list_edit_link_node");
}
}
if (!I2CE_FormStorage::isWritable($this->type)) {
$this->template->removeNodeById('list_edit_link_node');
}
$this->template->setAttribute("task", "can_view_database_list_" . $this->type, "list_view_link_node");
$this->template->setForm($this->list);
$this->showChildren();
$this->showMapped();
return true;
}
示例2: setDisplayData
/**
* Set the data to be displayed for the outside of the form field elements.
*
* Set up the static data to be displayed in the template. The default method
* doesn't do anything, but sub-classes may need to override this method.
* */
protected function setDisplayData()
{
parent::setDisplayData();
$add_type = array('type' => $this->type, "nosetdefault" => $this->request("nosetdefault"));
if (($hiddenSelectNode = $this->template->getElementByName('show_i2ce_hidden', 0)) instanceof DOMElement) {
$this->template->addHeaderLink("mootools-core.js");
$url = "index.php/lists?" . http_build_query($add_type) . '&show_i2ce_hidden=';
$js = 'document.location.href = "' . addslashes($url) . '" + this.get("value");';
$hiddenSelectNode->setAttribute('onChange', $js);
$this->template->selectOptionsImmediate('show_i2ce_hidden', $this->showHidden());
}
if (($primary = $this->getPrimary()) instanceof I2CE_List) {
$this->template->setDisplayData("type_name", $primary->getDisplayName());
$this->template->setDisplayData("type", $primary->getName());
$this->template->setDisplayData("id", $primary->getNameId());
}
$this->template->setDisplayData("link", $this->request("link"));
$this->template->setDisplayData("mapped", $this->request("mapped"));
$this->template->setDisplayData("nosetdefault", $this->request("nosetdefault"));
$this->template->setDisplayData("i2ce_template", $this->request("i2ce_template"));
if (I2CE_FormStorage::isWritable($this->type)) {
$this->template->setDisplayData("list_is_writable", 1);
} else {
$this->template->setDisplayData("list_is_writable", 0);
}
$show_link = $add_type;
if ($this->select_field instanceof I2CE_FormField) {
$add_type['field'] = $this->select_field->getName();
if ($this->request("nosetdefault") != "1" && $this->select_field->isSetValue()) {
$add_type[$this->select_field->getHTMLName()] = $this->select_field->getDBValue();
}
if ($this->select_field->isSetValue()) {
$show_link[$this->select_field->getHTMLName()] = $this->select_field->getDBValue();
} else {
$show_link[$this->select_field->getHTMLName()] = '';
}
$show_link['field'] = $this->select_field->getName();
$show_link['id'] = $this->id;
$this->template->setDisplayData('field', $this->select_field->getName());
$this->template->setDisplayData('field_name', $this->select_field->getHeader());
} else {
$this->template->setDisplayData('field', '');
$this->template->setDisplayData('field_name', '');
}
$this->template->setDisplayData('do_not_show_i2ce_hidden_link', $show_link);
$this->template->setDisplayData('do_show_i2ce_hidden_link', $show_link);
$add_type['show_i2ce_hidden'] = $this->showHidden();
$this->template->setDisplayData("add_type", $add_type);
if ($this->get_exists('add') || substr($this->id, -2) == "|0") {
$return_page = "lists?";
} else {
$return_page = $this->getViewPage($this->type) . "?id=" . $this->id;
}
foreach ($add_type as $key => $val) {
$return_page .= "&{$key}={$val}";
}
$this->template->setDisplayData("add_return", $return_page);
}
示例3: setTemplateVars
protected function setTemplateVars($listConfig, $link_data = array())
{
if (!is_array($link_data)) {
$link_data = array();
}
$this->template->setDisplayData('text', $listConfig['text']);
if (!$listConfig['type']) {
$link_data['form'] = $listConfig['form'];
} else {
$link_data['type'] = $listConfig['type'];
}
if ($listConfig['type']) {
$this->template->setDisplayData('type', $listConfig['type']);
} else {
$this->template->setDisplayData('form', $listConfig['form']);
}
$link_data['show_i2ce_hidden'] = $this->showHidden();
if ($this->request_exists('letter') && $this->request('letter')) {
$link_data['letter'] = $this->request('letter');
}
$this->template->setDisplayData('add_new_link', $link_data);
if (($hiddenSelectNode = $this->template->getElementByName('show_i2ce_hidden', 0)) instanceof DOMElement) {
$this->template->addHeaderLink("mootools-core.js");
$h_link_data = $link_data;
if (array_key_exists('show_i2ce_hidden', $h_link_data)) {
unset($h_link_data['show_i2ce_hidden']);
}
$url = "index.php/auto_list?" . http_build_query($h_link_data) . '&show_i2ce_hidden=';
$js = 'document.location.href = "' . addslashes($url) . '" + this.get("value");';
$hiddenSelectNode->setAttribute('onChange', $js);
$this->template->selectOptionsImmediate('show_i2ce_hidden', $this->showHidden());
}
$can_edit = true;
if (array_key_exists('edit_task', $listConfig) && !$this->hasPermission('task(' . $listConfig['edit_task'] . ')')) {
$can_edit = false;
}
if ($can_edit && I2CE_FormStorage::isWritable($this->getPrimaryFormName())) {
$this->template->setDisplayData("list_is_writable", 1);
} else {
$this->template->setDisplayData("list_is_writable", 0);
}
if (($link = $this->getRemapAllLink($listConfig)) && $this->hasRemapData($listConfig)) {
$this->template->setDisplayData('list_hasremap', 1);
$this->template->setDisplayData('remap_link', $link);
} else {
$this->template->setDisplayData('list_hasremap', 0);
}
$this->addAlphabet($link_data);
}