本文整理汇总了PHP中Concrete\Core\Attribute\Type::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getByID方法的具体用法?PHP Type::getByID怎么用?PHP Type::getByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Attribute\Type
的用法示例。
在下文中一共展示了Type::getByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($id = null, $type = null)
{
$this->select_type($id, $type);
$type = Type::getByID($type);
$entity = $this->getEntity($id);
$this->set('entity', $entity);
$this->executeAdd($type, \URL::to('/dashboard/system/express/entities/attributes', 'view', $id));
}
示例2: getItemsFromRequest
public function getItemsFromRequest($array)
{
$items = array();
foreach ($array as $id) {
$item = Type::getByID($id);
if (is_object($item)) {
$attributeType = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\AttributeType();
$attributeType->setItemId($item->getAttributeTypeID());
$items[] = $attributeType;
}
}
return $items;
}
示例3: save_attribute_type_associations
public function save_attribute_type_associations()
{
$list = Category::getList();
foreach ($list as $cat) {
$cat->clearAttributeKeyCategoryTypes();
if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) {
foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) {
$type = Type::getByID($id);
$cat->associateAttributeKeyType($type);
}
}
}
$this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated');
}
示例4: add
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'));
StoreProductKey::add($type, $this->post());
$this->redirect('/dashboard/store/products/attributes/', 'success');
}
}
示例5: dispatch
public function dispatch($action)
{
$arguments = explode('/', trim($action, '/'));
if (count($arguments) > 2) {
// there must at last be three arguments here
if (isset($arguments[0])) {
switch ($arguments[0]) {
case 'key':
if (isset($arguments[1])) {
$key = Key::getByID($arguments[1]);
if (is_object($key)) {
$controller = $key->getController();
}
}
break;
case 'type':
if (isset($arguments[1])) {
$type = Type::getByID($arguments[1]);
if (is_object($type)) {
$controller = $type->getController();
}
}
break;
}
}
if (isset($controller)) {
$action = $arguments[2];
$arguments = array_slice($arguments, 3);
if (method_exists($controller, 'action_' . $action)) {
//make sure the controller has the right method
$response = call_user_func_array(array($controller, 'action_' . $action), $arguments);
if ($response instanceof Response) {
return $response;
} else {
print $response;
$this->app->shutdown();
}
}
}
}
$response = new Response(t('Access Denied'));
return $response;
}
示例6: update
public function update()
{
$akID = $this->post('akID');
$key = AttributeFormKey::getByID($akID);
if (!is_object($key) || $key->isAttributeKeyInternal()) {
$this->redirect('/dashboard/forms/attributes/');
}
$type = $key->getAttributeType();
$cnt = $type->getController();
$cnt->setAttributeKey($key);
$e = $cnt->validateKey($this->post());
if ($e->has()) {
$this->set('error', $e);
} else {
AttributeType::getByID($this->post('atID'));
$key->update($this->post());
$this->redirect('/dashboard/forms/attributes/', 'attribute_updated');
}
}
示例7: save_attribute_type_associations
public function save_attribute_type_associations()
{
if (!$this->token->validate('save_attribute_type_associations')) {
$this->error->add(t('Invalid CSRF token. Please refresh and try again.'));
return;
}
$manager = \ORM::entityManager();
$list = Category::getList();
foreach ($list as $cat) {
$cat->clearAttributeKeyCategoryTypes();
if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) {
foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) {
$type = Type::getByID($id);
$cat->getAttributeTypes()->add($type);
}
}
$this->entityManager->persist($cat);
}
$this->entityManager->flush();
$this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated');
}
示例8: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Attribute\Key\Key as AttributeKey;
use Concrete\Core\Attribute\Type as AttributeType;
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);
}
}
示例9: action_get_type_form
public function action_get_type_form()
{
$field = explode('|', $this->request->request->get('id'));
if ($field[0] == 'attribute_key') {
$type = Type::getByID($field[1]);
if (is_object($type)) {
ob_start();
echo $type->render(new AttributeTypeSettingsContext());
$html = ob_get_contents();
ob_end_clean();
$obj = new \stdClass();
$obj->content = $html;
$obj->showControlRequired = true;
$obj->showControlName = true;
$obj->assets = $this->getAssetsDefinedDuringOutput();
}
} else {
if ($field[0] == 'entity_property') {
$obj = new \stdClass();
switch ($field[1]) {
case 'text':
$controller = new TextOptions();
ob_start();
echo $controller->render();
$html = ob_get_contents();
ob_end_clean();
$obj = new \stdClass();
$obj->content = $html;
$obj->showControlRequired = false;
$obj->showControlName = false;
$obj->assets = $this->getAssetsDefinedDuringOutput();
break;
}
}
}
if (isset($obj)) {
return new JsonResponse($obj);
}
\Core::make('app')->shutdown();
}
示例10: getAttributeType
/**
* Returns an attribute type object
*/
public function getAttributeType()
{
return AttributeType::getByID($this->atID);
}
示例11: add
public function add($type = null)
{
$this->select_type($type);
$type = Type::getByID($type);
$this->executeAdd($type, \URL::to('/dashboard/users/attributes', 'view'));
}
示例12: add
public function add()
{
$this->select_type();
$type = $this->get('type');
$cnt = $type->getController();
$e = $cnt->validateKey($this->post());
if ($e->has()) {
$this->error = $e;
} else {
$type = AttributeType::getByID($this->post('atID'));
$ak = UserAttributeKey::add($type, $this->post());
$this->redirect('/dashboard/users/attributes/', 'attribute_created');
}
}
示例13: edit
public function edit($akID = 0)
{
if ($this->post('akID')) {
$akID = $this->post('akID');
}
$key = StoreProductKey::getByID($akID);
$type = $key->getAttributeType();
$this->set('key', $key);
$this->set('type', $type);
$this->set('category', AttributeKeyCategory::getByHandle('store_product'));
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/store/products/attributes', 'updated');
}
}
}
示例14: getAttributeTypeObject
public function getAttributeTypeObject()
{
$ato = \Concrete\Core\Attribute\Type::getByID($this->atID);
return $ato;
}
示例15: edit
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->error = $e;
} else {
$type = AttributeType::getByID($this->post('atID'));
$key->update($this->post());
$this->redirect('/dashboard/pages/attributes/', 'attribute_updated');
}
}
}