/**
  * save
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function save()
 {
     $this->core->logger->debug('massiveart->generic->data->GenericDataTypeMember->save()');
     try {
         $this->getModelMembers()->setLanguageId($this->setup->getLanguageId());
         $intUserId = Zend_Auth::getInstance()->getIdentity()->id;
         /**
          * add|edit|newVersion core and instance data
          */
         switch ($this->setup->getActionType()) {
             case $this->core->sysConfig->generic->actions->add:
                 $arrCoreData = array('idRootLevels' => $this->setup->getRootLevelId(), 'idGenericForms' => $this->setup->getGenFormId(), 'idUsers' => $intUserId, 'creator' => $intUserId, 'created' => date('Y-m-d H:i:s'));
                 if (count($this->setup->CoreFields()) > 0) {
                     foreach ($this->setup->CoreFields() as $strField => $obField) {
                         if ($strField == 'password') {
                             if ($obField->getValue() != '') {
                                 $arrCoreData[$strField] = md5($obField->getValue());
                             }
                         } else {
                             $arrCoreData[$strField] = $obField->getValue();
                         }
                     }
                 }
                 /**
                  * add contact 
                  */
                 $this->setup->setElementId($this->objModelMembers->addMember($arrCoreData));
                 break;
             case $this->core->sysConfig->generic->actions->edit:
                 $arrCoreData = array('idUsers' => $intUserId);
                 if (count($this->setup->CoreFields()) > 0) {
                     foreach ($this->setup->CoreFields() as $strField => $obField) {
                         if ($strField == 'password') {
                             if ($obField->getValue() != '') {
                                 $arrCoreData[$strField] = md5($obField->getValue());
                             }
                         } else {
                             $arrCoreData[$strField] = $obField->getValue();
                         }
                     }
                 }
                 /**
                  * add contact 
                  */
                 $this->objModelMembers->editMember($this->setup->getElementId(), $arrCoreData);
                 break;
         }
         return $this->setup->getElementId();
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
Esempio n. 2
0
 public function index()
 {
     parent::index();
     $search = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
     $this->f3->set('search', $search);
     $this->f3->set('data', Model_Members::getJSON('assets/js/Quiz1.json', $search));
     $this->f3->set('js', 'loadMembers()');
     echo View::instance()->render('views/layout.html');
 }
Esempio n. 3
0
 /**
  * 保存成员信息
  */
 function actionSave()
 {
     __TRY();
     $this->_modelMembers->saveMember($_POST);
     $ex = __CATCH();
     if (__IS_EXCEPTION($ex)) {
         return $this->_editMember($_POST, $ex->getMessage());
     }
     js_alert(_T('ui_m_member_success'), '', $this->_url('index'));
 }
Esempio n. 4
0
 /**
  * 显示成员信息
  */
 function actionMembers()
 {
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 0;
     FLEA::loadClass('FLEA_Helper_Pager');
     $table =& $this->_modelMembers->getTable();
     $pager =& new FLEA_Helper_Pager($table, $page, 20, null, 'member_id DESC');
     $pk = $table->primaryKey;
     $rowset = $pager->findAll();
     $this->_setBack();
     include APP_DIR . '/ZobMembers.php';
 }
 /**
  * getModelMembers
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 protected function getModelMembers()
 {
     if (null === $this->objModelMembers) {
         /**
          * autoload only handles "library" compoennts.
          * Since this is an application model, we need to require it
          * from its modules path location.
          */
         require_once GLOBAL_ROOT_PATH . $this->core->sysConfig->path->zoolu_modules . 'core/models/Members.php';
         $this->objModelMembers = new Model_Members();
         $this->objModelMembers->setLanguageId($this->getItemLanguageId());
     }
     return $this->objModelMembers;
 }
Esempio n. 6
0
 /**
  * 上传成员照片
  *
  * @param FLEA_Helper_UploadFile $file
  *
  * @return boolean
  */
 function _uploadPhoto($member, &$file)
 {
     // 将照片文件裁减为指定大小,并保存起来
     FLEA::loadClass('FLEA_Helper_Image');
     $image =& FLEA_Helper_Image::createFromFile($file->getTmpName(), $file->getExt());
     $image->crop(FLEA::getAppInf('photoWidth'), FLEA::getAppInf('photoHeight'));
     $filename = $member['member_id'] . '-photo-t' . time() . '.jpg';
     $image->saveAsJpeg(FLEA::getAppInf('uploadDir') . DS . $filename);
     $image->destory();
     // 更新数据库
     if ($member['photo'] != '') {
         unlink(FLEA::getAppInf('uploadDir') . DS . $member['photo']);
     }
     $member['photo'] = $filename;
     return $this->_tbMembers->update($member);
 }