Ejemplo n.º 1
0
 /**
  * 编辑
  * Enter description here ...
  */
 public function edit()
 {
     $cmd = $this->input->post('cmd');
     if ($cmd && $cmd == 'submit') {
         $Area_id = $this->input->post('Area_id');
         $dataArray = array('title' => $this->input->post('title'), 'level' => $this->input->post('level'), 'pid' => $this->input->post('pid'));
         $result = $this->AreaModel->edit($dataArray, 'id=' . $Area_id);
         if ($result) {
             $totalResult = $this->AreaModel->getListByWhere('');
             //更新XML文件开始
             $tree = new Tree();
             $treeResult = $tree->create($totalResult, 1);
             //大树
             $file = fopen("../uploadfile/Area/Area.xml", "w");
             $xml = new XML();
             $res = $xml->xml_serialize($treeResult, 0, null);
             fwrite($file, $res);
             //将序列化的字符写进文件
             //print_r($res);
             fclose($file);
             show_error('index.php/Area/index', 500, '提示信息:地区修改成功!');
         } else {
             show_error('index.php/Area/index', 500, '提示信息:地区修改失败!');
         }
     } else {
         $Area_id = $this->input->get('id');
         if ($Area_id) {
             $Area = $this->AreaModel->get('id=' . $Area_id);
             $parent = $this->AreaModel->getListByWhere('');
             $tree = new Tree();
             $this->load->view('Area/edit', array('Area' => $Area, 'parent' => $tree->create($parent)));
         } else {
             show_error('index.php/Area/index', 500, '提示信息:参数错误!');
         }
     }
 }
Ejemplo n.º 2
0
 /**
 * 此接口负责把应用程序的积分设置传递给 UCenter,以供 UCenter 在积分兑换设置中使用。
 * 此接口无输入参数。输出的数组需经过 uc_serialize 处理。
 * 输出的数组单条结构:
     [
     '1' => ['威望', ''],
     '2' => ['金钱', '枚'],
     ]
 * @return string
 */
 function getcreditsettings()
 {
     if (!self::API_GET_CREDIT_SETTINGS) {
         return self::API_RETURN_FORBIDDEN;
     }
     return XML::xml_serialize([1 => ['积分', '']]);
     $credits = array();
     foreach ($_G['setting']['extcredits'] as $id => $extcredits) {
         $credits[$id] = array(strip_tags($extcredits['title']), $extcredits['unit']);
     }
     return $this->_serialize($credits);
 }