public static function getListByPackage($pkg) { $db = Loader::db(); $list = array(); $r = $db->Execute('select asID from AttributeSets where pkgID = ? order by asID asc', array($pkg->getPackageID())); while ($row = $r->FetchRow()) { $list[] = AttributeSet::getByID($row['asID']); } $r->Close(); return $list; }
public function getAttributeSets() { $db = Loader::db(); $sets = array(); $r = $db->Execute('select asID from AttributeSetKeys where akID = ?', $this->akID); while ($row = $r->FetchRow()) { $sets[] = AttributeSet::getByID($row['asID']); } return $sets; }
public static function exportList($xml) { $axml = $xml->addChild('attributesets'); $db = Loader::db(); $r = $db->Execute('select asID from AttributeSets order by asID asc'); $list = array(); while ($row = $r->FetchRow()) { $list[] = AttributeSet::getByID($row['asID']); } foreach ($list as $as) { $as->export($axml); } }
<?php defined('C5_EXECUTE') or die("Access Denied."); $canRead = false; $ch = Page::getByID($_REQUEST['cID']); $path = $ch->getCollectionPath(); if (strpos($path, '/dashboard') === 0) { $cp = new Permissions($ch); if ($cp->canViewPage()) { $canRead = true; } } if (!$canRead) { die(t("Access Denied.")); } // this should be cleaned up.... yeah $db = Loader::db(); // update order of collections Loader::model('user_attributes'); $uats = $_REQUEST['akID_' . $_REQUEST['asID']]; if (is_array($uats)) { $as = AttributeSet::getByID($_REQUEST['asID']); $as->updateAttributesDisplayOrder($uats); }
public function addSet($asHandle, $asName, $pkg = false) { if ($this->akCategoryAllowSets > AttributeKeyCategory::ASET_ALLOW_NONE) { $db = Loader::db(); $pkgID = 0; if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } $db->Execute('insert into AttributeSets (asHandle, asName, akCategoryID, pkgID) values (?, ?, ?, ?)', array($asHandle, $asName, $this->akCategoryID, $pkgID)); $id = $db->Insert_ID(); $as = AttributeSet::getByID($id); return $as; } }
public function edit($asID = false) { $as = AttributeSet::getByID($asID); if (is_object($as)) { $this->set('set', $as); } else { $this->redirect('/dashboard/system/attributes/sets'); } }
public function addSet($asHandle, $asName, $pkg = false, $asIsLocked = 1) { if ($this->akCategoryAllowSets > AttributeKeyCategory::ASET_ALLOW_NONE) { $db = Loader::db(); $pkgID = 0; if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } $sets = $db->GetOne('select count(asID) from AttributeSets where akCategoryID = ?', array($this->akCategoryID)); $asDisplayOrder = 0; if ($sets > 0) { $asDisplayOrder = $db->GetOne('select max(asDisplayOrder) from AttributeSets where akCategoryID = ?', array($this->akCategoryID)); $asDisplayOrder++; } $db->Execute('insert into AttributeSets (asHandle, asName, akCategoryID, asIsLocked, asDisplayOrder, pkgID) values (?, ?, ?, ?, ?,?)', array($asHandle, $asName, $this->akCategoryID, $asIsLocked, $asDisplayOrder, $pkgID)); $id = $db->Insert_ID(); $as = AttributeSet::getByID($id); return $as; } }