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');
 }
Exemple #2
0
	public static function getList() {
		$db = Loader::db();
		$atHandles = $db->GetCol("select atHandle from AttributeTypes");
		
		$dh = Loader::helper('file');
		$available = array();
		if (is_dir(DIR_MODELS . '/' . DIRNAME_ATTRIBUTES . '/' .  DIRNAME_ATTRIBUTE_TYPES)) {
			$contents = $dh->getDirectoryContents(DIR_MODELS . '/' . DIRNAME_ATTRIBUTES . '/' .  DIRNAME_ATTRIBUTE_TYPES);
			foreach($contents as $atHandle) {
				if (!in_array($atHandle, $atHandles)) {
					$available[] = PendingAttributeType::getByHandle($atHandle);
				}
			}
		}
		return $available;
	}
Exemple #3
0
		<? } ?>

	</table>
	<div class="well clearfix">
	<?
	$b1 = $interface->submit(t('Save'), 'attribute_type_associations_form', 'right', 'primary');
	print $b1;
	?>
	</div>
</form>

<h3><?=t('Custom Attribute Types')?></h3>
<?
$ch = Loader::helper('concrete/interface');
$types = PendingAttributeType::getList(); ?>
<? if (count($types) == 0) { ?>
	<?=t('There are no available attribute types awaiting installation.')?>
<? } else { ?>
	<ul id="ccm-block-type-list">
		<? foreach($types as $at) { ?>
			<li class="ccm-block-type ccm-block-type-available">
				<form id="attribute_type_install_form_<?=$at->getAttributeTypeHandle()?>" style="margin: 0px" method="post" action="<?=$this->action('add_attribute_type')?>">
					<?
					print $form->hidden("atHandle", $at->getAttributeTypeHandle());
					?>
					<p style="background-image: url(<?=$at->getAttributeTypeIconSRC()?>)" class="ccm-block-type-inner"><?=$ch->submit(t("Install"), 'submit', 'right', 'small')?><?=$at->getAttributeTypeName()?></p>
				</form>
			</li>
		<? } ?>
	</ul>