This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 
<?php defined('C5_EXECUTE') or die('Access Denied');

class Concrete5_Controller_Dashboard_System_Attributes_Types extends DashboardBaseController {
    
    public function add_attribute_type() {
        $pat = PendingAttributeType::getByHandle($this->post('atHandle'));
        if (is_object($pat)) {
            $pat->install();
        }
        $this->redirect('dashboard/system/attributes/types', 'saved', 'attribute_type_added');
    }

    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 function saved($mode = false) {

        if ($mode != false) {
            switch($mode) {
                case 'associations_updated':
                    $this->set('message', t('Attribute Type Associations saved.'));
                    break;
                case 'attribute_type_added':
                    $this->set('message', t('Attribute Type added.'));
                    break;
            }
        }
    }
    
}