示例#1
0
 /**
  * @return array
  */
 public function getAll()
 {
     $query = $this->getAdapter()->select()->from(["pf" => $this->getTableName()])->order("pf.sorting");
     $result = $this->getAdapter()->fetchAll($query);
     foreach ($result as $_key => $_result) {
         $values = [];
         switch (self::$types[$_result['type_id']]) {
             case 'select':
                 $queryValues = $this->getAdapter()->select()->from(["pfv" => $this->_dbprefix . "profilefields_values"])->where('profilefield_id = ' . $_result['id'])->order("pfv.sorting");
                 $values = $queryValues->getAdapter()->fetchAll($queryValues);
                 break;
             default:
                 break;
         }
         $value = new ProfileFieldsUsers([], $_SESSION['user']);
         $res = $value->getByProfileFieldIdAndUserId($_result['id']);
         $result[$_key]['label'] = $_result['value'];
         $result[$_key]['value'] = $res['value'];
         $result[$_key]['values'] = $values;
         $result[$_key]['type'] = self::$types[$_result['type_id']];
     }
     return $result;
 }