Exemple #1
0
 public static function add($at, $args, $pkg = false)
 {
     CacheLocal::delete('file_attribute_key_by_handle', $args['akHandle']);
     $ak = parent::addAttributeKey('file', $at, $args, $pkg);
     return $ak;
 }
 public static function add($at, $args, $pkg = false)
 {
     // legacy check
     $fargs = func_get_args();
     if (count($fargs) >= 5) {
         $at = $fargs[4];
         $pkg = false;
         $args = array('akHandle' => $fargs[0], 'akName' => $fargs[1], 'akIsSearchable' => $fargs[2]);
     }
     CacheLocal::delete('collection_attribute_key_by_handle', $args['akHandle']);
     $ak = parent::addAttributeKey('collection', $at, $args, $pkg);
     return $ak;
 }
Exemple #3
0
 public static function add($type, $args, $pkg = false)
 {
     CacheLocal::delete('user_attribute_key_by_handle', $args['akHandle']);
     $ak = parent::addAttributeKey('user', $type, $args, $pkg);
     extract($args);
     if ($uakProfileDisplay != 1) {
         $uakProfileDisplay = 0;
     }
     if ($uakMemberListDisplay != 1) {
         $uakMemberListDisplay = 0;
     }
     if ($uakProfileEdit != 1) {
         $uakProfileEdit = 0;
     }
     if ($uakProfileEditRequired != 1) {
         $uakProfileEditRequired = 0;
     }
     if ($uakRegisterEdit != 1) {
         $uakRegisterEdit = 0;
     }
     if ($uakRegisterEditRequired != 1) {
         $uakRegisterEditRequired = 0;
     }
     if (isset($uakIsActive) && !$uakIsActive) {
         $uakIsActive = 0;
     } else {
         $uakIsActive = 1;
     }
     $db = Database::connection();
     $displayOrder = $db->fetchColumn('select max(displayOrder) from UserAttributeKeys');
     if (!$displayOrder) {
         $displayOrder = 0;
     }
     ++$displayOrder;
     $v = array($ak->getAttributeKeyID(), $uakProfileDisplay, $uakMemberListDisplay, $uakProfileEdit, $uakProfileEditRequired, $uakRegisterEdit, $uakRegisterEditRequired, $displayOrder, $uakIsActive);
     $db->executeQuery('insert into UserAttributeKeys (akID, uakProfileDisplay, uakMemberListDisplay, uakProfileEdit, uakProfileEditRequired, uakRegisterEdit, uakRegisterEditRequired, displayOrder, uakIsActive) values (?, ?, ?, ?, ?, ?, ?, ?, ?)', $v);
     $nak = new static();
     $nak->load($ak->getAttributeKeyID());
     return $nak;
 }