本文整理汇总了PHP中CustomField::constructObject方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::constructObject方法的具体用法?PHP CustomField::constructObject怎么用?PHP CustomField::constructObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomField
的用法示例。
在下文中一共展示了CustomField::constructObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addField
protected function addField($row)
{
$field = CustomField::constructObject($row);
if ($field != null) {
$this->fields[$row['position']][$field->getFieldName()] = $field;
}
}
示例2: suggest
public function suggest()
{
$data = array();
$id = Request::get(1, VAR_INT);
$q = Request::get('q');
$q = SystemEnvironment::fromUtf8($q);
$db = Database::getObject();
$db->query("SELECT * FROM <p>fields WHERE id = <id:int>", compact("id"));
if ($db->numRows() == 1) {
$field = CustomField::constructObject($db->fetchAssoc());
if ($field instanceof CustomAutoCompleteTextField) {
$data = $field->getList($q);
}
}
Response::getObject()->sendHeader('Content-Type: text/plain; charset=' . Config::get('intl.charset'));
echo implode("\n", $data);
}
示例3: edit
public function edit()
{
$id = Request::get(1, VAR_INT);
$isSent = Request::get(2, VAR_URI) == 'send';
$this->breadcrumb->add('Bearbeiten');
$this->header();
$db = Database::getObject();
$db->query("SELECT * FROM <p>fields WHERE id = <id:int>", compact("id"));
if ($db->numRows() == 0) {
CmsPage::error('Das Feld wurde leider nicht gefunden.');
$this->overview();
} else {
$field = CustomField::constructObject($db->fetchAssoc());
$_positions = $this->getPositions();
$positions = Core::constructObjectArray($_positions);
// Fill data array with the default (currently saved) data
$permissions = $field->getPermissions();
$data = array('name' => $field->getName(), 'description' => $field->getDescription(), 'priority' => $field->getPriority(), 'position' => $field->getPosition()->getClassPath(), 'type' => $field->getClassPath(), 'read' => $permissions['read'], 'write' => $permissions['write']);
foreach ($field->getParamsData() as $key => $value) {
$data[$key] = $value;
}
$error = array();
if ($isSent) {
// Base options for every field
$options = array_merge($this->getValidator(), array('position' => array(Validator::MESSAGE => 'Der Anzeigeort ist ungültig.', Validator::LIST_CS => $_positions)), $field->getValidationParams(false));
extract(Validator::checkRequest($options));
if (count($error) == 0) {
$this->injectDataToField($field, $data);
if ($field->update()) {
CmsPage::ok("Das Feld wurde erfolgreich aktualisiert.");
} else {
$error[] = 'Das Feld konnt leider nicht aktualisiert werden.';
}
}
if (count($error) > 0) {
CmsPage::error($error);
}
}
$tpl = Response::getObject()->appendTemplate("/Cms/admin/fields_edit");
$tpl->assign('field', $field, false);
$tpl->assign('positions', $positions, false);
$tpl->assign('data', $data);
$tpl->assign('baseUri', $this->getBaseURI());
$tpl->output();
}
$this->footer();
}