/**
 Adds a new group        @return boolean
 @throws Exception
 */
 public function add()
 {
     global $__in, $__out;
     if ($__in['__is_form_submitted']) {
         // if form is submitted
         try {
             $group = new group();
             $group->add($__in['group']);
             return dispatcher::redirect("getall", "added_successfully");
         } catch (ValidationException $ex) {
             $ex->publish_errors();
             $__out['group'] = $__in['group'];
             return false;
         } catch (Exception $ex) {
             throw $ex;
         }
     } else {
         // if form is not submitted
         $__out['group'] = array();
         return true;
     }
     // end if form submitted
 }
Beispiel #2
0
    if ($process > -1) {
        $condition .= " AND process={$process}";
    }
    $timetype = strpos($dorder[$order], 'add') !== false ? 'add' : '';
}
switch ($action) {
    case 'add':
        if ($submit) {
            if ($do->pass($post)) {
                if ($FD) {
                    fields_check($post_fields);
                }
                if ($CP) {
                    property_check($post_ppt);
                }
                $do->add($post);
                if ($FD) {
                    fields_update($post_fields, $table, $do->itemid);
                }
                if ($CP) {
                    property_update($post_ppt, $moduleid, $post['catid'], $do->itemid);
                }
                if ($MOD['show_html'] && $post['status'] > 2) {
                    $do->tohtml($do->itemid);
                }
                dmsg('添加成功', '?moduleid=' . $moduleid . '&action=' . $action);
            } else {
                msg($do->errmsg);
            }
        } else {
            foreach ($do->fields as $v) {
Beispiel #3
0
        if ($setting['fee_mode']) {
            //收费会员
            if ($vip > 9) {
                $do->vip = $vip = 9;
            }
            if ($vip < 1) {
                $do->vip = $vip = 1;
            }
            $setting['fee'] = intval($setting['fee']);
            if ($setting['fee'] < 1) {
                $setting['fee'] = 3000;
            }
        } else {
            $do->vip = $vip = $setting['fee'] = 0;
        }
        $do->add($setting);
        dmsg('添加成功', $this_forward);
    } else {
        include load('homepage.lang');
        $do->groupid = 7;
        extract($do->get_one());
        $groupname = '';
        $discount = 100;
        $menuid = 0;
        include tpl('group_edit', $module);
    }
} else {
    if ($action == 'edit') {
        $groupid or msg();
        if ($submit) {
            if (!$groupname) {