Пример #1
0
 function getFormCode()
 {
     $oForm = new BxTemplFormView($this->aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aValsAdd = array('Date' => time(), 'Uri' => $oForm->generateUri(), 'Status' => 'active', 'Owner' => $this->iOwnerId);
         if ($this->iAlbumId > 0 && $this->aInfo['Owner'] == $this->iOwnerId) {
             $aValsAdd = array('Date' => time());
             if (!$oForm->update($this->iAlbumId, $aValsAdd)) {
                 return MsgBox(_t('_sys_album_save_error'));
             } else {
                 return MsgBox(_t('_sys_album_save_succ'));
             }
         } else {
             $iAlbumId = $oForm->insert($aValsAdd);
             if (!$iAlbumId) {
                 return MsgBox(_t('_sys_album_save_error'));
             } else {
                 return MsgBox(_t('_sys_album_save_succ'));
             }
         }
     } else {
         return $oForm->getCode();
     }
 }
Пример #2
0
 function getPostForm($aAddFields = array())
 {
     $oForm = new BxTemplFormView($this->_aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iDateNow = mktime();
         $iDatePublish = $oForm->getCleanValue('when');
         if ($iDatePublish > $iDateNow) {
             $iStatus = BX_TD_STATUS_PENDING;
         } else {
             if ($iDatePublish <= $iDateNow && $this->_oModule->_oConfig->isAutoapprove()) {
                 $iStatus = BX_TD_STATUS_ACTIVE;
             } else {
                 $iStatus = BX_TD_STATUS_INACTIVE;
             }
         }
         $aDefFields = array('uri' => $oForm->generateUri(), 'date' => $iDateNow, 'status' => $iStatus);
         $iId = $oForm->insert(array_merge($aDefFields, $aAddFields));
         //--- 'System' -> Post for Alerts Engine ---//
         bx_import('BxDolAlerts');
         $oAlert = new BxDolAlerts($this->_oModule->_oConfig->getAlertsSystemName(), 'post', $iId, $this->_iOwnerId);
         $oAlert->alert();
         //--- 'System' -> Post for Alerts Engine ---//
         //--- Reparse Global Tags ---//
         $oTags = new BxDolTags();
         $oTags->reparseObjTags($this->_oModule->_oConfig->getTagsSystemName(), $iId);
         //--- Reparse Global Tags ---//
         //--- Reparse Global Categories ---//
         $oCategories = new BxDolCategories();
         $oCategories->reparseObjTags($this->_oModule->_oConfig->getCategoriesSystemName(), $iId);
         //--- Reparse Global Categories ---//
         header('Location: ' . $oForm->aFormAttrs['action']);
     } else {
         return $oForm->getCode();
     }
 }