public function delete()
 {
     $sMod = $this->httpRequest->post('mod');
     $sName = $this->httpRequest->post('name');
     if (Field::unmodifiable($sName) || !Field::isExists($sMod, $sName)) {
         $bStatus = false;
     } else {
         $bStatus = (new FieldModel(Field::getTable($sMod), $sName))->delete();
         /* Clean UserCoreModel Cache */
         if ($bStatus) {
             (new Cache())->start(UserCoreModel::CACHE_GROUP, null, null)->clear();
         }
     }
     $sMsg = $bStatus ? t('The field has been deleted') : t('An error occurred while deleting the field.');
     $sMsgType = $bStatus ? 'success' : 'error';
     Header::redirect(Uri::get('field', 'field', 'all', $sMod), $sMsg, $sMsgType);
 }
 public function __construct()
 {
     parent::__construct();
     $sMod = $this->httpRequest->get('mod');
     $sName = $this->httpRequest->post('name');
     $sType = $this->httpRequest->post('type');
     $iLength = $this->httpRequest->post('length');
     $sDefVal = $this->httpRequest->post('value');
     if (Field::unmodifiable($sName)) {
         \PFBC\Form::setError('form_edit_field', t('Bad field name!'));
     } else {
         $bRet = (new FieldModel(Field::getTable($sMod), $sName, $sType, $iLength, $sDefVal))->update();
         if ($bRet) {
             /* Clean UserCoreModel Cache */
             (new Cache())->start(UserCoreModel::CACHE_GROUP, null, null)->clear();
             Header::redirect(Uri::get('field', 'field', 'all', $sMod), t('The field has been edited.'));
         } else {
             \PFBC\Form::setError('form_edit_field', t('Oops! An error occurred while adding the field, please try again.'));
         }
     }
 }