public function save_attribute_type_associations() { $list = AttributeKeyCategory::getList(); foreach ($list as $cat) { $cat->clearAttributeKeyCategoryTypes(); if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) { foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) { $type = AttributeType::getByID($id); $cat->associateAttributeKeyType($type); } } } $this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated'); }
public static function add($atHandle, $atName, $pkg = false) { $pkgID = 0; if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } $db = Loader::db(); $db->Execute('insert into AttributeTypes (atHandle, atName, pkgID) values (?, ?, ?)', array($atHandle, $atName, $pkgID)); $id = $db->Insert_ID(); $est = AttributeType::getByID($id); $path = $est->getAttributeTypeFilePath(FILENAME_ATTRIBUTE_DB); if ($path) { Package::installDB($path); } return $est; }
public function add() { $this->select_type(); $type = $this->get('type'); $cnt = $type->getController(); $e = $cnt->validateKey($this->post()); if ($e->has()) { $this->set('error', $e); } else { $type = AttributeType::getByID($this->post('atID')); $ak = UserAttributeKey::add($type, $this->post()); $this->redirect('/dashboard/users/attributes/', 'attribute_created'); } }
/** * Returns an attribute type object */ public function getAttributeType() { return AttributeType::getByID($this->atID); }
public function getAttributeTypeObject() { $ato = AttributeType::getByID($this->atID); return $ato; }
<?php defined('C5_EXECUTE') or die("Access Denied."); if (isset($_REQUEST['akID'])) { $at = AttributeKey::getInstanceByID($_REQUEST['akID']); } else { $at = AttributeType::getByID($_REQUEST['atID']); } if (is_object($at)) { $cnt = $at->getController(); if (isset($_REQUEST['args']) && is_array($_REQUEST['args'])) { $args = $_REQUEST['args']; } else { $args = array(); } if (method_exists($cnt, 'action_' . $_REQUEST['action'])) { //make sure the controller has the right method call_user_func_array(array($cnt, 'action_' . $_REQUEST['action']), $args); } }
public function edit($akID = 0) { if ($this->post('akID')) { $akID = $this->post('akID'); } $key = CollectionAttributeKey::getByID($akID); if (!is_object($key) || $key->isAttributeKeyInternal()) { $this->redirect('/dashboard/pages/attributes'); } $type = $key->getAttributeType(); $this->set('key', $key); $this->set('type', $type); if ($this->isPost()) { $cnt = $type->getController(); $cnt->setAttributeKey($key); $e = $cnt->validateKey($this->post()); if ($e->has()) { $this->set('error', $e); } else { $type = AttributeType::getByID($this->post('atID')); $key->update($this->post()); $this->redirect('/dashboard/pages/attributes/', 'attribute_updated'); } } }
public function edit($akID = 0) { if ($this->post('akID')) { $akID = $this->post('akID'); } $key = CollectionAttributeKey::getByID($akID); $type = $key->getAttributeType(); $this->set('key', $key); $this->set('type', $type); if ($this->isPost()) { $cnt = $type->getController(); $cnt->setAttributeKey($key); $e = $cnt->validateKey($this->post()); if ($e->has()) { $this->set('error', $e); } else { $type = AttributeType::getByID($this->post('atID')); $args = array('akHandle' => $this->post('akHandle'), 'akName' => $this->post('akName'), 'akIsSearchable' => $this->post('akIsSearchable'), 'akIsSearchableIndexed' => $this->post('akIsSearchableIndexed'), 'akIsAutoCreated' => 0, 'akIsEditable' => 1); $key->update($this->post()); $this->redirect('/dashboard/pages/attributes/', 'attribute_updated'); } } }
public function add() { $this->select_type(); $type = $this->get('type'); $cnt = $type->getController(); $e = $cnt->validateKey($this->post()); if ($e->has()) { $this->set('error', $e); } else { $type = AttributeType::getByID($this->post('atID')); $args = array( 'akHandle' => $this->post('akHandle'), 'akName' => $this->post('akName'), 'akIsSearchable' => $this->post('akIsSearchable'), 'akIsSearchableIndexed' => $this->post('akIsSearchableIndexed'), 'uakProfileDisplay' => $this->post('uakProfileDisplay'), 'uakMemberListDisplay' => $this->post('uakMemberListDisplay'), 'uakProfileEdit' => $this->post('uakProfileEdit'), 'uakProfileEditRequired' => $this->post('uakProfileEditRequired'), 'uakRegisterEdit' => $this->post('uakRegisterEdit'), 'uakRegisterEditRequired' => $this->post('uakRegisterEditRequired'), 'akIsAutoCreated' => 0, 'akIsEditable' => 1 ); $ak = UserAttributeKey::add($type, $this->post()); $this->redirect('/dashboard/users/attributes/', 'attribute_created'); } }