예제 #1
0
 /**
  * Vykreslí fieldset
  * VOLÁ SE V HOOCE
  * 
  * @author Jan Pokorný
  * @param WP_User $user
  */
 public function renderFieldset(WP_User $user)
 {
     if (count(array_intersect($this->roles, $user->roles)) < 1) {
         // Průnik rolí
         return;
     }
     wp_enqueue_media();
     $fieldset = $this->getFieldset();
     $fieldsData = $fieldset->getSerializeSave() ? get_user_meta($user->ID, $fieldset->getName(), true) : KT_WP_User_Base_Model::getUserMetas($user->ID);
     $fieldset->setFieldsData($fieldsData);
     echo $fieldset->getInputsToTable();
 }
예제 #2
0
 /**
  * Načte data do všech fieldsetů na základě userId z tabulky wp_usermeta
  *
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  *
  * @param int $userId
  * @return \KT_Form
  */
 public function loadDataFromUserMeta($userId)
 {
     if (KT::isIdFormat($userId) && $this->hasFieldset()) {
         $userMetas = KT_WP_User_Base_Model::getUserMetas($userId);
         foreach ($this->getFieldsets() as $fieldset) {
             /* @var $fieldset \KT_Form_Fieldset */
             if ($fieldset->hasFields()) {
                 if ($fieldset->getSerializeSave()) {
                     $fieldset->setFieldsData($userMetas[$fieldset->getName()]);
                     continue;
                 }
                 $fieldset->setFieldsData($userMetas);
             }
         }
     }
     return $this;
 }