Exemplo n.º 1
5
 function do_dl_csv($f3, $args)
 {
     if (!rStaff::_isLogin()) {
         return parent::_return(8001);
     }
     $rows = $this->_db->exec("SELECT * FROM `" . self::fmTbl() . "` ORDER BY insert_ts DESC ");
     if (!$rows) {
         header("Content-Type:text/html; charset=utf-8");
         echo '無結果';
     } else {
         $template = new Template();
         f3()->set('rows', $rows);
         Outfit::_setXls("contact_" . date("YmdHis"));
         echo $template->render('contact.dl.html', "application/vnd.ms-excel");
     }
 }
Exemplo n.º 2
3
 function do_save_new_schedules($f3, $args)
 {
     $allData = json_decode(f3()->get('SESSION.uploadPrograms'), true);
     db()->begin();
     foreach ($allData['schedules'] as $prog) {
         $program = Program::get_program_by_codename($prog['c']);
         if (empty($program)) {
             $program['title'] = $prog['c'];
             $program['uri'] = '';
             $program['id'] = 0;
         }
         db()->exec("INSERT INTO `" . tpf() . "schedules`(`title`, `uri`, `program_id`, `start_date`, `end_date`, `status`, `last_ts`, " . "`last_user`, `insert_user`, `insert_ts`) VALUES ('" . $program['title'] . "', '" . $program['uri'] . "', '" . $program['id'] . "', '" . $prog['d'] . " " . $prog['s'] . ":00', '" . $prog['d'] . " " . $prog['e'] . ":00', 'Yes', '" . date('Y-m-d H:i:s') . "', '" . rStaff::_CStaff('id') . "', '" . rStaff::_CStaff('id') . "', '" . date('Y-m-d H:i:s') . "')");
     }
     db()->commit();
     return parent::_return(1, $allData['schedules']);
 }
Exemplo n.º 3
2
 /**
  * save sorter
  * @param  object $f3   - $f3
  * @param  array  $args - uri params
  * @return array        - std json
  */
 function do_update_sorter($f3, $args)
 {
     rStaff::_chkLogin();
     $req = parent::_getReq();
     foreach ($req['data'] as $row) {
         fMenu::update_sorter($row['id'], $row['sorter']);
     }
     return parent::_return(1, $req);
 }
Exemplo n.º 4
0
 /**
  * save photo
  * @param  object $f3   - $f3
  * @param  array  $args - uri params
  * @return array        - std json
  */
 function do_editor_upload($f3, $args)
 {
     rStaff::_chkLogin();
     list($filename, $width, $height, $title) = Upload::savePhoto(f3()->get('FILES'), array(f3()->get('all_thn')));
     $response = new \StdClass();
     $response->link = f3()->get('uri') . $filename;
     echo stripslashes(json_encode($response));
 }
Exemplo n.º 5
0
 function do_preview($f3, $args)
 {
     rStaff::_chkLogin();
     $cu = fPress::get_row('/' . $args['slug'], 'slug', '', true);
     if (empty($cu)) {
         f3()->error(404);
     }
     f3()->set('cu', $cu);
     parent::wrapper('press/content.html', $cu['title'], '/press' . $cu['slug']);
 }
Exemplo n.º 6
0
 static function insert($req)
 {
     $now = date('Y-m-d H:i:s');
     $obj = self::map();
     $obj->insert_ts = $now;
     $obj->insert_user = rStaff::_CStaff('id');
     $obj->last_ts = $now;
     $obj->last_user = rStaff::_CStaff('id');
     $obj->status = self::ST_ON;
     $obj->title = $title;
     $obj->pic = $filename;
     $obj->slug = '/' . parent::_slugify($title);
     $obj->save();
     return $obj->id;
 }
Exemplo n.º 7
0
 function do_get_one($f3, $args)
 {
     rStaff::_chkLogin();
     $req = parent::_getReq();
     if (!isset($req['pid'])) {
         return parent::_return(8004);
     }
     if ($req['pid'] == 0) {
         return parent::_return(1, array('id' => 0));
     }
     $cu = fStaff::get_row($req['pid']);
     if ($cu == null) {
         return parent::_return(8106);
     }
     unset($cu['pwd']);
     return parent::_return(1, $cu);
 }
Exemplo n.º 8
0
 function do_preview($f3, $args)
 {
     rStaff::_chkLogin();
     $cu = fPost::get_row('/' . $args['slug'], 'slug', '', true);
     if (empty($cu)) {
         f3()->error(404);
     }
     f3()->set('cu', $cu);
     switch ($cu['slug']) {
         case '/about':
             $tmpl = 'about.html';
             break;
         case '/ourservice':
             $tmpl = 'ourservice.html';
             break;
         default:
             $tmpl = 'post.html';
             break;
     }
     f3()->set('bc_ary', array(array('link' => 'javascript:;', 'title' => $cu['title'])));
     parent::wrapper($tmpl, $cu['title'], '/post' . $cu['slug']);
 }
Exemplo n.º 9
0
 function do_get_opts($f3, $args)
 {
     $that = get_called_class();
     $feed = parent::_shift($that, 'feed');
     rStaff::_chkLogin();
     $req = self::_getReq();
     if (!isset($req['query'])) {
         return self::_return(8004);
     }
     $rows = $feed::get_opts($req['query']);
     return self::_return(1, $rows);
 }