<?php require_once ykfile('source/talk_service.php'); require_once ykfile('source/tag_service.php'); $talk_id = intval($_GET['talk_id']); $talksrv = new TalkService(); $talk = $talksrv->get_by_id($talk_id); // 获取所有的标签对象 $tagSer = new TagService(); $tag_list = $tagSer->get_all(); if ($talk == NULL) { $talk = new ActivityModel(); $talk->type = ActivityModel::type_talk; $talk->author = new UserModel(); } $page_title = '编辑演讲'; include ykfile('pages/admin/edit_talk.php');
<?php $act_id = intval($_GET['act_id']); $type = intval($_GET['type']); $is_delete = intval($_GET['is_delete']); if ($type == 0) { // 演讲 $talkSer = new TalkService(); $ret = $talkSer->remove_talk($act_id, $is_delete); } else { if ($type == 1) { // 沙龙活动 $acticitySer = new ActivityService(); $ret = $acticitySer->remove_activity($act_id, $is_delete); } else { //mooc $moocSer = new MoocService(); $ret = $moocSer->remove_mooc($act_id, $is_delete); } } if ($ret == 0) { echo json_encode(array("status" => 0, "message" => "删除成功")); } else { echo json_encode(array("status" => $ret, "message" => "删除失败")); }
/** * Process a form to edit an existing talk. * * @param integer $id The id of the talk to edit. * * @return mixed The response. */ public function processEditTalk($id) { try { // Get inputs. $talk = new Talk(); $talk->number = Input::get('number'); $talk->subject = Input::get('subject'); $talk->locale_id = Input::get('locale_id'); // Update talk. TalkService::updateTalk($id, $talk); $this->success(trans('messages.talkUpdated')); return Redirect::route('talks.list'); } catch (ValidationException $e) { return Redirect::route('talks.edit', compact('id'))->withInput(Input::all())->withErrors($e->getValidator()); } catch (Exception $e) { return $this->unexpected($e); } }
<?php header("Content-type: text/html; charset=utf-8"); require_once "config.php"; require_once ykfile("source/talk_service.php"); $talkService = new TalkService(); $talk_list = $talkService->get_talk_all(@$tag_id, @$next_id, @$pagesize, STAGE_INDEX); // 页面标题,显示在导航栏上 $page_title = "热门演讲"; if ($talk_list != 1000 && count($talk_list) != 0) { require_once ykfile("pages/talk/talkList.php"); } else { echo "没有有效的数据!"; }
<?php require_once "../config.php"; require_once ykfile("source/talk_service.php"); header("application/json;charset=utf-8"); $next_id = intval($_GET['next_id']); if ($next_id < 0) { $next_id = 0; } $count = intval($_GET['count']); if ($count <= 0 || $count > 1000) { $count = 10; } $talkService = new TalkService(); $talk_list = $talkService->get_talk_all(@$tag_id, $next_id, $count, STAGE_INDEX); if ($talk_list != 1000 && !empty($talk_list)) { $json_array = array("activities" => $talk_list); echo json_encode($json_array); } else { }
<?php require_once ykfile('source/model/section_model.php'); require_once ykfile('source/talk_service.php'); require_once ykfile('source/activity_service.php'); $params = json_decode(file_get_contents('php://input')); $type = intval($_GET['type']); if ($type == 0) { $talksrv = new TalkService(); $ret = $talksrv->save_section($params); } else { $srv = new ActivityService(); $ret = $srv->save_section($params); } if ($ret !== false) { echo json_encode(array("status" => "0", "message" => "保存成功", "section" => $ret)); } else { echo json_encode(array("status" => 0, "message" => "保存失败")); }
<?php require_once ykfile('source/talk_service.php'); $next_id = intval($_GET['next_id']); $count = intval($_GET['count']); if ($count <= 0) { $count = 10; } $talksrv = new TalkService(); $talk_list = $talksrv->get_talk_all(NULL, $next_id, $count, STAGE_ADMIN); $talk_total = $talksrv->get_talk_count(NULL); // 以下4个参数,必须计算出来,分页器要使用 // page_cur: 当前页, 从1开始计算 // page_count: 总页数 // page_prefix: 点页数后,取数据的url前缀 // next_id: 下一页超始数据 $page_cur = intval(($next_id + 1 + 9) / 10); $page_count = intval(($talk_total + 9) / 10); $page_prefix = "/m/admin.php?mod=talk"; $next_id += $count; include ykfile('pages/admin/talk_list.php');
<?php require_once ykfile('source/portal_service.php'); require_once ykfile('source/talk_service.php'); require_once ykfile('source/talker_service.php'); require_once ykfile('source/modules/adv_module.php'); require_once ykfile('source/activity_service.php'); $talksrv = new TalkService(); $talks = $talksrv->get_talk_all(NULL, 0, 1000, STAGE_ADMIN); $actsrv = new ActivityService(); $activities = $actsrv->get_all(NULL, 0, 1000, STAGE_ADMIN); $talkersrv = new TalkerService(); $talkers = $talkersrv->get_all(0, 1000); $porsrv = new PortalService(); $channels = $porsrv->get_portal_content(); $advmod = new AdvModule(); $advs = $advmod->get_adv(0, 1000); $page_title = '编辑首页'; include ykfile('pages/admin/edit_portal.php');
<?php require_once "../config.php"; require_once ykfile("source/talk_service.php"); require_once ykfile("source/comment_service.php"); /** * 演讲详情页 */ $talk_id = intval($_GET['id']); $talkService = new TalkService(); $talk = $talkService->get_by_id($talk_id); $page_title = "演讲详情"; $comsrv = new CommentService(); $comments = $comsrv->get_comments($talk_id, 0, 3); require_once ykfile("pages/talk/detail.php");