function loadTimeline() { global $bdd; global $_TABLES; $content = ""; $view = new Template(dirname(dirname(__FILE__)) . '/html/article.html'); if (!is_null($bdd) && !is_null($_TABLES)) { $objTimeline = new Timeline($bdd, $_TABLES); $articles = $objTimeline->getTimeline(); if (!is_null($articles)) { foreach ($articles as $key => $value) { $temp_subscription = ''; if (isset($_SESSION['user_auth']) && $_SESSION['user_auth'] == '1' && isset($_SESSION['user_subscription'])) { if (in_array($value->website_id, $_SESSION['user_subscription'])) { $temp_subscription = "<div class='unsubscription' website_id='%%website_id%%'></div>"; } else { $temp_subscription = "<div class='subscription' website_id='%%website_id%%'></div>"; } } $content .= $view->getView(array("url" => '/to/' . $value->guid . '#' . $value->url, "title" => $value->title, "width_image" => $value->width_image, "height_image" => $value->height_image, "image" => $value->image, "alt_image" => $value->alt_image, "description" => $value->description, "logo_site" => $value->logo, "alt_logo_site" => $value->website, "title_site" => $value->website, "subscription" => $temp_subscription, "website_id" => $value->website_id)); } return $content; } else { // 404 return "404 Not Found"; } } else { error_log("BDD ERROR : " . json_encode($bdd)); error_log("TABLES ERROR : " . json_encode($_TABLES)); } }
function showDays() { $day = date('Y-m-d '); //echo date($day,strtotime('-1 day'));; $endday = strtotime("2014-8-1 0:0:0"); $endday = date('Y-m-d', $endday); $i = 1; do { $db = new PictureDB(); $result = $db->selectByDay($i - 1); //print_r($result); $p = new PictureTimeline(); $p->data["picture"] = $result; $dbscrum = new TaskDB(); $tasks = $dbscrum->selectByDay($i - 1); $s = new ScrumTimeline(); $s->alldata = $tasks; $timeline = new Timeline(); $timeline->data["day"] = $day; $timeline->picture = $p; $timeline->scrum = $s; $timeline->showDay(); $day = date('Y-m-d ', strtotime("-{$i} day")); $i++; } while ($day >= $endday); }
public function set($message, $params = array()) { $browser = new Browser(); $model = new Timeline(); $model->user_id = Yii::app()->user->id; $model->message = Yii::t('timeline', $message, $params); $model->user_agent = $browser->getUserAgent(); $model->ip = CMS::getip(); $model->user_platform = $browser->getPlatform(); $model->save(false, false, false); }
public function GetOlderPosts() { #Aumenta o contador if (!$this->session->times_reloaded) { $this->session->times_reloaded = new stdClass(); } $list_id = is_null($this->post->list_id) ? '' : $list_id; $o = new stdClass(); $o->min = $this->post->min_id; $o->max = $this->post->max_id; if ($this->post->list_id == '') { $data = Timeline::build($this->session->user->id, $o); $posts = $this->render($data); } elseif ($this->post->list_id == 'bookmarks') { $data = $this->MyFavorites($o); $posts = $this->render($data); } elseif ($this->post->list_id == 'all_posts') { $data = Timeline::get_public_posts($o); $posts = $this->render($data); } elseif (is_numeric($this->post->list_id)) { $data = Timeline::build_from_list($this->session->user->id, $list_id, $o); $posts = $this->render($data); } header("Content-type: text/html; charset=utf-8"); if (is_array($posts)) { foreach ($posts as $post) { echo $post; } } else { die(''); } }
public function show($id) { $employee = Employee::findOrFail($id); $registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('employee_id', '=', $id)->orderBy('registration_date', 'desc')->get(); $earnings = Earning::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('employee_id', '=', $id)->get(); $retrievals = Retrieval::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('employee_id', '=', $id)->get(); $timelines = Timeline::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('informable_type', '=', 'Employee')->where('informable_id', '=', $id)->get(); $menu = 'employee'; return View::make('employees.show', compact('employee', 'registrations', 'earnings', 'retrievals', 'timelines', 'menu')); }
/** * Delete wiki page, revisions and timeline events. */ public function delete() { foreach ($this->revisions()->fetchAll() as $revision) { $revision->delete(); } $timelineEvents = Timeline::select()->where("owner_type = :ownerType")->andWhere('owner_id = :ownerId')->setParameter(':ownerType', 'WikiPage')->setParameter(':ownerId', $this['id'])->fetchAll(); foreach ($timelineEvents as $event) { $event->delete(); } return parent::delete(); }
/** * @file index * @author ryan <*****@*****.**> * @created Jun 27, 2012 6:24:01 PM */ function index() { $recentTeachers = Teacher::search()->orderBy('touched DESC')->find(); $recentComments = Comment::search()->OrderBy('id DESC')->find(); $data = compact('recentTeachers', 'recentCourses', 'recentComments'); if ($GLOBALS['has_login']) { $timelines = Timeline::search()->filterBy('user', $GLOBALS['user'])->find(); $data['timelines'] = $timelines; } render_view('master', $data); }
public function discuss($content, User $user) { $info = compact('content', 'user'); $info['comment'] = $this; $d = Discuss::create($info); // generate activity $info = array('user' => $user, 'action' => 'discuss', 'object' => $this, 'link' => $d); $act = Activity::create($info); // inform all stack holders $info = array('activity' => $act, 'user' => $this->user); Timeline::create($info); }
public function comment($title, $content, User $user) { $c = parent::comment($title, $content, $user); // generate activity $info = array('user' => $user, 'action' => 'comment', 'object' => $this, 'link' => $c); $act = Activity::create($info); // inform all stack holders $users = Sdb::fetch('user', Comment::table(), array('teacher=?' => array($this->id))); $info = array('activity' => $act); foreach ($users as $u) { $info['user'] = $u; Timeline::create($info); } }
function addAction(Application $app) { $timeline = new Timeline(); $url = $app['url_generator']->generate('add'); $form = $timeline->return_item_form($url, 'edit'); // The validation or display if ($form->validate()) { $values = $form->exportValues(); $values['type'] = 0; $values['status'] = 0; $my_timeline = new CTimeline(); $my_timeline->setCId(api_get_course_int_id()); $my_timeline->setHeadline($values['headline']); $my_timeline->setType($values['type']); $my_timeline->setStartDate($values['start_date']); $my_timeline->setEndDate($values['end_date']); $my_timeline->setText($values['text']); $my_timeline->setMedia($values['media']); $my_timeline->setMediaCredit($values['media_credit']); $my_timeline->setMediaCaption($values['media_caption']); $my_timeline->setTitleSlide($values['title_slide']); $my_timeline->setParentId($values['parent_id']); $my_timeline->setStatus($values['status']); $app['orm.em']->persist($my_timeline); $app['orm.em']->flush(); $message = Display::return_message(sprintf(get_lang('ItemUpdated'), $values['name']), 'confirmation'); //$app['session']->setFlash('error', $message); return $app->redirect($app['url_generator']->generate('view', array('id' => $my_timeline->getId())), 201); } else { $actions = '<a href="' . $app['url_generator']->generate('index') . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>'; $content = $form->return_form(); } $app['template']->assign('content', $content); $response = $app['template']->render_layout('layout_1_col.tpl'); return new Response($response, 200, array()); }
/** * View: Video Index * @return Respanse */ public function getVideoIndex() { $articles = Article::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(6); $travel = Travel::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(4); $product = Product::orderBy('created_at', 'desc')->where('post_status', 'open')->where('quantity', '>', '0')->paginate(12); $productCategories = ProductCategories::orderBy('sort_order')->where('cat_status', 'open')->get(); $job = Job::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(4); $categories = Category::orderBy('sort_order')->where('cat_status', 'open')->get(); if (Auth::check()) { $timeline = Timeline::orderBy('created_at', 'desc')->where('user_id', Auth::user()->id)->paginate(6); } else { $timeline = Timeline::orderBy('created_at', 'desc'); } return View::make('home.videoindex')->with(compact('articles', 'categories', 'travel', 'product', 'productCategories', 'job', 'timeline')); }
/** * @author ryan <*****@*****.**> */ function attitude($type) { if (!$GLOBALS['has_login']) { return; } $class = camel2under($type); $map = array('like' => 1, 'hate' => 0); $target = _req('target'); $action = _req('action'); $info = array($type => $target, 'user' => $GLOBALS['user'], '`like`' => $map[$action]); $at = Attitude::create($info); if ($at) { $info = array('user' => $GLOBALS['user'], 'action' => $action, 'object' => $target); $act = Activity::create($info); // inform author $comment = new $class($target); $info = array('user' => $comment->user, 'activity' => $act); Timeline::create($info); } $o = new $class($target); echo $o->{$action . 'Count'}(); }
<?php /* For licensing terms, see /license.txt */ /** @author Julio Montoya <*****@*****.**> BeezNest 2011 * @package chamilo.timeline */ require_once '../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH) . 'timeline.lib.php'; $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Listing')); $timeline = new Timeline(); if (empty($_GET['id'])) { api_not_allowed(); } $url = $timeline->get_url($_GET['id']); $item = $timeline->get($_GET['id']); $interbreadcrumb[] = array('url' => '#', 'name' => $item['headline']); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/timeline/timeline.css'); $htmlHeadXtra[] = api_get_js('timeline/timeline-min.js'); $htmlHeadXtra[] = ' <script> $(document).ready(function() { var timeline = new VMM.Timeline(); timeline.init("' . $url . '"); }); </script>'; $content = '<div class="timeline-example"><div id="timeline"></div></div>'; $tpl = new Template($tool_name); $tpl->assign('actions', $actions); $tpl->assign('message', $message);
function setDriver($driver) { //require_once '../framework/DBConnect.php'; // opening db connection $db = new Connection(); $conn = $db->connect(); $vehicle = new Vehicle($this->id); $prevDriver = $vehicle->getDriver(); if ($prevDriver == $driver) { return false; } $mUser = new User(); $sql = "UPDATE vehicle SET driver = '{$driver}' WHERE id = '{$this->id}'"; //print_r($sql); if (mysqli_query($conn, $sql)) { //print_r("<br>Record updated successfully"); if ($driver != 0) { $action = 1; //assigning driver } else { $action = -1; //removing driver $driver = $prevDriver; } return Timeline::addTimelineEvent("driver_allotment", $this->id, $driver, "", $mUser->getId(), $action); } else { //print_r("<br>Error updating record: " . mysqli_error($conn)); return false; } }
<?php # Ex 5 : Delete a tweet include "timeline.php"; $tl = new Timeline(); try { $tl->delete($_POST["no"]); header("Location:index.php"); } catch (Exception $e) { header("Location:error.php"); }
public function store() { // Get StudentID // From student_id or Create New // Create Registration // Create Issue // Create Education // Create Placement // Create Receivables // Reductions // Create Installment try { //DB::beginTransaction(); if (Input::get('student_id') == 0) { // Create New Student $student = new Student(); $student->name = Input::get('name'); $student->sex = Input::get('sex'); $student->birthplace = Input::get('birthplace'); $student->birthdate = date('Y-m-d', strtotime(Input::get('birthdate'))); $student->religion = Input::get('religion'); $student->address = Input::get('address'); $student->contact = Input::get('contact'); $student->email = Input::get('email'); if (Input::get('sex') == 'L') { $student->photo = 'boy.png'; } else { $student->photo = 'girl.png'; } $student->father_name = Input::get('father_name'); $student->father_occupation = Input::get('father_occupation'); $student->father_address = Input::get('father_address'); $student->father_contact = Input::get('father_contact'); $student->father_email = Input::get('father_email'); $student->mother_name = Input::get('mother_name'); $student->mother_occupation = Input::get('mother_occupation'); $student->mother_address = Input::get('mother_address'); $student->mother_contact = Input::get('mother_contact'); $student->mother_email = Input::get('mother_email'); $student->save(); $id = $student->id; } else { $student = Student::find(Input::get('student_id')); $student->name = Input::get('name'); $student->sex = Input::get('sex'); $student->birthplace = Input::get('birthplace'); $student->birthdate = date('Y-m-d', strtotime(Input::get('birthdate'))); $student->religion = Input::get('religion'); $student->address = Input::get('address'); $student->contact = Input::get('contact'); $student->email = Input::get('email'); if (Input::get('sex') == 'L') { $student->photo = 'boy.png'; } else { $student->photo = 'girl.png'; } $student->father_name = Input::get('father_name'); $student->father_occupation = Input::get('father_occupation'); $student->father_address = Input::get('father_address'); $student->father_contact = Input::get('father_contact'); $student->father_email = Input::get('father_email'); $student->mother_name = Input::get('mother_name'); $student->mother_occupation = Input::get('mother_occupation'); $student->mother_address = Input::get('mother_address'); $student->mother_contact = Input::get('mother_contact'); $student->mother_email = Input::get('mother_email'); $student->save(); $id = $student->id; } // Create Registration Data $registration = new Registration(); $registration->project_id = Auth::user()->curr_project_id; $registration->location_id = Auth::user()->location_id; $registration->student_id = $id; $registration->classification_id = Input::get('classification'); $registration->base_id = Input::get('location'); $registration->registration_date = date('Y-m-d', strtotime(Input::get('registration_date'))); $registration->registration_cost = Input::get('fee'); $registration->recommender_type = Input::get('recommender_type'); $registration->recommender_id = Input::get('recommender_id'); $registration->employee_id = Input::get('employee'); $registration->save(); // Create Issue $issue = new Issue(); $issue->project_id = Auth::user()->curr_project_id; $issue->location_id = Auth::user()->location_id; $issue->registration_id = $registration->id; $issue->generation_id = Input::get('generation'); $issue->student_id = $id; $issue->issue = Input::get('issue'); $issue->save(); //Create Education Data if (Input::get('school') != '0') { $education = new Education(); $education->project_id = Auth::user()->curr_project_id; $education->issue_id = $issue->id; $education->school_id = Input::get('school'); $education->generation_id = Input::get('generation'); $education->save(); } // Receivables - Registration Costs $receivable = new Receivable(); $receivable->project_id = Auth::user()->curr_project_id; $receivable->location_id = Auth::user()->location_id; $receivable->issue_id = $issue->id; $receivable->registration_id = $registration->id; $receivable->total = Input::get('total'); $receivable->billable = Input::get('billable'); $receivable->receivable = Input::get('receivables'); $receivable->balance = Input::get('billable'); if (Input::get('payment') == 0) { $receivable->payment = 'Cash'; } else { $receivable->payment = 'Installment'; } $receivable->save(); $billable = Input::get('billable'); $payment = Input::get('payment'); if ((int) $payment > 0) { // First Installment $installment = new Installment(); $installment->project_id = Auth::user()->curr_project_id; $installment->location_id = Auth::user()->location_id; $installment->receivable_id = $receivable->id; $installment->schedule = Input::get('registration_date'); $installment->total = $billable / $payment; $installment->balance = $billable / $payment; $installment->paid = 0; $installment->save(); // Extracting Date $dd = (int) substr(Input::get('registration_date'), 8, 2); $mm = (int) substr(Input::get('registration_date'), 5, 2); $yy = (int) substr(Input::get('registration_date'), 0, 4); if ($dd > 25) { $mm += 2; if ($mm > 12) { $new_mm = $mm - 12; $yy += 1; } else { $new_mm = $mm; } } else { $mm += 1; if ($mm > 12) { $new_mm = $mm - 12; $yy += 1; } else { $new_mm = $mm; } } for ($i = 2; $i <= $payment; $i++) { $installment_date = $yy . '-' . str_pad($new_mm, 2, "0", STR_PAD_LEFT) . '-' . '05'; $installment = new Installment(); $installment->project_id = Auth::user()->curr_project_id; $installment->location_id = Auth::user()->location_id; $installment->receivable_id = $receivable->id; $installment->schedule = date('Y-m-d', strtotime($installment_date)); $installment->total = $billable / $payment; $installment->balance = $billable / $payment; $installment->paid = 0; $installment->save(); $new_mm += 1; if ($new_mm > 12) { $new_mm = $new_mm - 12; $yy += 1; } } } // Placements $courses = Input::get('course'); foreach ($courses as $key => $value) { $course = explode("#", $value); $placement = new Placement(); $placement->project_id = Auth::user()->curr_project_id; $placement->location_id = Auth::user()->location_id; $placement->registration_id = $registration->id; $placement->issue_id = $issue->id; $placement->course_id = $course[0]; $placement->save(); } // Reductions - Discounts $discounts = Input::get('discounts'); if ($discounts) { foreach ($discounts as $key => $value) { $discount = explode("#", $value); $reduction = new Reduction(); $reduction->project_id = Auth::user()->curr_project_id; $reduction->location_id = Auth::user()->location_id; $reduction->registration_id = $registration->id; $reduction->receivable_id = $receivable->id; $reduction->reductable_type = 'Discount'; $reduction->reductable_id = $discount[0]; $reduction->save(); } } // Reductions - Promotions $promotions = Input::get('promotions'); if ($promotions) { foreach ($promotions as $key => $value) { $promotion = explode("#", $value); $reduction = new Reduction(); $reduction->project_id = Auth::user()->curr_project_id; $reduction->location_id = Auth::user()->location_id; $reduction->registration_id = $registration->id; $reduction->receivable_id = $receivable->id; $reduction->reductable_type = 'Promotion'; $reduction->reductable_id = $promotion[0]; $reduction->save(); } } // Reductions - Vouchers $vouchers = Input::get('vouchers'); if ($vouchers) { foreach ($vouchers as $key => $value) { $voucher = explode("#", $value); $reduction = new Reduction(); $reduction->project_id = Auth::user()->curr_project_id; $reduction->location_id = Auth::user()->location_id; $reduction->registration_id = $registration->id; $reduction->receivable_id = $receivable->id; $reduction->reductable_type = 'Voucher'; $reduction->reductable_id = $voucher[0]; $reduction->save(); } } // Reductions - Charges $charges = Input::get('charges'); if ($charges) { foreach ($charges as $key => $value) { $charger = explode("#", $value); $reduction = new Reduction(); $reduction->project_id = Auth::user()->curr_project_id; $reduction->location_id = Auth::user()->location_id; $reduction->registration_id = $registration->id; $reduction->receivable_id = $receivable->id; $reduction->reductable_type = 'Charge'; $reduction->reductable_id = $charger[0]; $reduction->save(); } } // Updating Student Timelines $content = 'Bergabung menjadi Siswa One School ' . Auth::user()->location->name . 'untuk periode ' . Auth::user()->curr_project->name; $timeline = new Timeline(); $timeline->project_id = Auth::user()->curr_project_id; $timeline->location_id = Auth::user()->location_id; $timeline->informable_type = 'Issue'; $timeline->informable_id = $issue->id; $timeline->content = $content; $timeline->save(); // Updating Employee Timeline $content = 'Menerima Pendaftaran Siswa untuk periode ' . Auth::user()->curr_project->name; $timeline = new Timeline(); $timeline->project_id = Auth::user()->curr_project_id; $timeline->location_id = Auth::user()->location_id; $timeline->informable_type = 'Employee'; $timeline->informable_id = Input::get('employee'); $timeline->content = $content; $timeline->save(); //DB::commit(); return Response::json(array('status' => 'Succeed', 'registration_id' => $registration->id, 'issue_id' => $issue->id)); } catch (Exception $e) { DB::rollback(); return Response::json(array('status' => 'Failed', 'error' => $e)); } }
public static function addEmployee($name, $emp_id, $address_1, $address_2, $landmark, $city, $state, $pincode, $phone, $fax, $email, $website, $description) { $defaultPassword = '******'; if (!empty($_SESSION['user']['company'])) { //$retCode = User::add($name, '', $emp_id, $defaultPassword, $phone, $phone, $email, $address_1, $address_2, $landmark, $city, $state, $pincode, $_SESSION['user']['company']); if (User::add($name, '', $emp_id, $defaultPassword, $phone, $phone, $email, $address_1, $address_2, $landmark, $city, $state, $pincode, $_SESSION['user']['company'])) { User::activate(User::getIdByEmail($email)); $mEmployee = new User(User::getIdByEmail($email)); $mAddedBy = new User(); $mEmployee->SetAddedby($mAddedBy->getId()); Mailer::sendEmployeeAddedMessage($name, $emp_id, $email, $defaultPassword, $_SESSION['user']['company'], $mAddedBy->getFullname()); return Timeline::addTimelineEvent("staff_addition", "", "", $mEmployee->getId(), $mAddedBy->getId(), 1); return true; } return false; } else { return false; } }
private static function _toTimeline(Timeline $timelineDb) { return new TimelineModel($timelineDb->getId(), $timelineDb->getName(), UserDAO::get($timelineDb->getId())); }
function timeline() { require_once 'models/Timeline.php'; $timeline = new Timeline(); if ($_POST["method"] == "getHistoricalData") { if (isset($_POST["project"])) { $project = $_POST["project"]; } if ($project) { $objectData = $timeline->getHistoricalData($project); } else { $objectData = $timeline->getHistoricalData(); } echo json_encode($objectData); } else { if ($_POST["method"] == "getDistinctLocations") { $objectData = $timeline->getDistinctLocations(); echo json_encode($objectData); } else { if ($_POST["method"] == "storeLatLong") { $location = $_POST["location"]; $latlong = $_POST["latlong"]; $timeline->insertLocationData($location, $latlong); } else { if ($_REQUEST["method"] == "getLatLong") { $objectData = $timeline->getLocationData(); echo json_encode($objectData); } else { if ($_POST["method"] == "getListOfMonths") { $months = $timeline->getListOfMonths(); echo json_encode($months); } } } } } }
$count = count($users); break; case 'get_extra_fields': $type = $_REQUEST['type']; $obj = new ExtraField($type); $count = $obj->get_count(); break; case 'get_extra_field_options': $type = $_REQUEST['type']; $field_id = $_REQUEST['field_id']; $obj = new ExtraFieldOption($type); $count = $obj->get_count_by_field_id($field_id); break; case 'get_timelines': require_once $libpath . 'timeline.lib.php'; $obj = new Timeline(); $count = $obj->get_count(); break; case 'get_gradebooks': require_once $libpath . 'gradebook.lib.php'; $obj = new Gradebook(); $count = $obj->get_count(); break; case 'get_event_email_template': $obj = new EventEmailTemplate(); $count = $obj->get_count(); break; case 'get_careers': $obj = new Career(); $count = $obj->get_count(); break;
/** * Resource destory action * DELETE /resource/{id} * @param int $id * @return Response */ public function destroy($id) { $data = $this->model->find($id); if (is_null($data)) { return Redirect::back()->with('error', '没有找到对应的' . $this->resourceName . '。'); } elseif ($data) { $model = $this->model->find($id); $thumbnails = $model->thumbnails; if ($thumbnails != NULL) { destoryUploadImages($this->thumbnailsPath, $thumbnails); $images = JobPictures::where('job_id', $id)->get(); foreach ($images as $singleImage) { destoryUploadImages($this->destinationPath, $singleImage->filename); } } $timeline = Timeline::where('slug', $model->slug)->where('user_id', Auth::user()->id)->first(); $timeline->delete(); $data->delete(); return Redirect::back()->with('success', $this->resourceName . '删除成功。'); } else { return Redirect::back()->with('warning', $this->resourceName . '删除失败。'); } }
<?php /* For licensing terms, see /license.txt */ //require_once '../global.inc.php'; $timeline = new Timeline(); $action = $_GET['a']; switch ($action) { case 'get_timeline_content': $items = $timeline->get_timeline_content($_GET['id']); echo json_encode($items); break; }
public static function getInstance($timelineTestDate = null) { Timeline::setupSession($timelineTestDate); return StatelessTimeline::getInstance(); }
<?php # Ex 4 : Write a tweet include "timeline.php"; $tl = new Timeline(); try { if (preg_match("/^[a-zA-Z]+([\\ \\-]?[a-zA-Z]+)*\$/", $_POST["wau"]) && strlen($_POST["wau"]) <= 20 && strlen($_POST["wau"]) >= 1) { $tweet = array(); /* HTML 방지 */ $aut = $_POST["wau"]; $con = $_POST["wco"]; $newCon = htmlspecialchars($con, ENT_QUOTES); $newAut = htmlspecialchars($aut, ENT_QUOTES); array_push($tweet, $newAut); array_push($tweet, $newCon); $tl->add($tweet); header("Location:index.php"); } else { header("Location:error.php"); } } catch (Exception $e) { header("Location:error.php"); }
/** * @param Application $app * @return string */ public function indexAction(Application $app) { $request = $app['request']; $language_file = array('admin', 'exercice', 'gradebook', 'tracking'); // 1. Setting variables needed by jqgrid $action = $request->get('a'); $page = $request->get('page'); //page $limit = $request->get('rows'); //quantity of rows $sidx = $request->get('sidx'); //index (field) to filter $sord = $request->get('sord'); //asc or desc if (strpos(strtolower($sidx), 'asc') !== false) { $sidx = str_replace(array('asc', ','), '', $sidx); $sord = 'asc'; } if (strpos(strtolower($sidx), 'desc') !== false) { $sidx = str_replace(array('desc', ','), '', $sidx); $sord = 'desc'; } if (!in_array($sord, array('asc', 'desc'))) { $sord = 'desc'; } if (!in_array($action, array('get_exercise_results', 'get_hotpotatoes_exercise_results', 'get_work_user_list', 'get_timelines', 'get_user_skill_ranking', 'get_usergroups_teacher', 'get_question_list', 'get_user_list_plugin_widescale'))) { api_protect_admin_script(true); } if ($action == 'get_user_list_plugin_widescale') { $allowed = api_is_drh() || api_is_platform_admin(); if (!$allowed) { api_not_allowed(); } } // Search features. // If there is no search request sent by jqgrid, $where should be empty. $where_condition = ""; $operation = $request->get('oper'); $export_format = $request->get('export_format'); $search_field = $request->get('searchField'); $search_oper = $request->get('searchOper'); $search_string = $request->get('searchString'); $isSearch = $request->get('_search'); $filters = $request->get('filters'); $type = $request->get('type'); $extra_fields = array(); $questionFields = array(); if ($isSearch == 'true') { $where_condition = ' 1 = 1 '; $where_condition_in_form = $this->getWhereClause($search_field, $search_oper, $search_string); if (!empty($where_condition_in_form)) { $where_condition .= ' AND ' . $where_condition_in_form; } $filters = isset($filters) ? json_decode($filters) : false; // for now if (!empty($filters)) { switch ($action) { case 'get_questions': $extraFieldtype = 'question'; break; case 'get_sessions': $extraFieldtype = 'session'; break; } // Extra field. $extraField = new \ExtraField($extraFieldtype); $result = $extraField->getExtraFieldRules($filters, 'extra_'); $extra_fields = $result['extra_fields']; $condition_array = $result['condition_array']; if (!empty($condition_array)) { $where_condition .= ' AND ( '; $where_condition .= implode($filters->groupOp, $condition_array); $where_condition .= ' ) '; } // Question field. $resultQuestion = $extraField->getExtraFieldRules($filters, 'question_'); $questionFields = $resultQuestion['extra_fields']; $condition_array = $resultQuestion['condition_array']; if (!empty($condition_array)) { $where_condition .= ' AND ( '; $where_condition .= implode($filters->groupOp, $condition_array); $where_condition .= ' ) '; } } } // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if (!$sidx) { $sidx = 1; } //2. Selecting the count FIRST //@todo rework this switch ($action) { case 'get_questions': $categoryId = $request->get('categoryId'); $exerciseId = $request->get('exerciseId'); //$courseId = null; //$request->get('courseId'); $courseId = $request->get('courseId'); // Question manager can view all questions if (api_is_question_manager()) { $courseId = null; } $count = \Question::getQuestions($app, $categoryId, $exerciseId, $courseId, array('where' => $where_condition, 'extra' => $extra_fields, 'question' => $questionFields), true); break; case 'get_user_list_plugin_widescale': $count = \UserManager::get_user_data(null, null, null, null, true); break; case 'get_question_list': require_once api_get_path(SYS_CODE_PATH) . 'exercice/exercise.class.php'; $exerciseId = $request->get('exerciseId'); $exercise = new \Exercise(api_get_course_int_id()); $exercise->read($exerciseId); $count = $exercise->selectNbrQuestions(); break; case 'get_group_reporting': $course_id = $request->get('course_id'); $group_id = $request->get('gidReq'); $count = \Tracking::get_group_reporting($course_id, $group_id, 'count'); break; case 'get_user_course_report_resumed': $count = \CourseManager::get_count_user_list_from_course_code(true, 'ruc'); break; case 'get_user_course_report': $count = \CourseManager::get_count_user_list_from_course_code(false); break; case 'get_course_exercise_medias': $course_id = api_get_course_int_id(); $count = \Question::get_count_course_medias($course_id); break; case 'get_user_skill_ranking': $skill = new \Skill(); $count = $skill->get_user_list_skill_ranking_count(); break; case 'get_work_user_list': require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php'; $work_id = $request->get('work_id'); //$_REQUEST['work_id']; $count = get_count_work($work_id); break; case 'get_exercise_results': $exercise_id = $request->get('exerciseId'); //$_REQUEST['exerciseId']; $filter_by_user = $request->get('filter_by_user'); if (isset($filter_by_user) && !empty($filter_by_user)) { $filter_user = intval($filter_by_user); if ($where_condition == "") { $where_condition .= " te.exe_user_id = '{$filter_user}'"; } else { $where_condition .= " AND te.exe_user_id = '{$filter_user}'"; } } $count = \ExerciseLib::get_count_exam_results($exercise_id, $where_condition); break; case 'get_hotpotatoes_exercise_results': $hotpot_path = $request->get('path'); //$_REQUEST['path']; $count = \ExerciseLib::get_count_exam_hotpotatoes_results($hotpot_path); break; case 'get_sessions': $list_type = $request->get('list_type'); if ($list_type == 'simple' || empty($list_type)) { $count = \SessionManager::get_sessions_admin(array('where' => $where_condition, 'extra' => $extra_fields), true); } else { $count = \SessionManager::get_count_admin_complete(array('where' => $where_condition, 'extra' => $extra_fields)); } break; case 'get_extra_fields': $obj = new \ExtraField($type); $count = $obj->get_count(); break; case 'get_extra_field_options': $field_id = $request->get('field_id'); $obj = new \ExtraFieldOption($type); $count = $obj->get_count_by_field_id($field_id); break; case 'get_timelines': $obj = new \Timeline(); $count = $obj->get_count(); break; case 'get_gradebooks': $obj = new \Gradebook(); $count = $obj->get_count(); break; case 'get_event_email_template': $obj = new \EventEmailTemplate(); $count = $obj->get_count(); break; case 'get_careers': $obj = new \Career(); $count = $obj->get_count(); break; case 'get_promotions': $obj = new \Promotion(); $count = $obj->get_count(); break; case 'get_grade_models': $obj = new \GradeModel(); $count = $obj->get_count(); break; case 'get_usergroups': $obj = new \UserGroup(); $count = $obj->get_count(); break; case 'get_usergroups_teacher': $obj = new \UserGroup(); $course_id = api_get_course_int_id(); if ($type == 'registered') { $count = $obj->get_usergroup_by_course_with_data_count($course_id); } else { $count = $obj->get_count(); } break; default: exit; } //3. Calculating first, end, etc $total_pages = 0; if ((int) $count > 0) { if (!empty($limit)) { $total_pages = ceil($count / $limit); } } if ($page > $total_pages) { $page = $total_pages; } $start = $limit * $page - $limit; if ($start < 0) { $start = 0; } //4. Deleting an element if the user wants to if ($operation == 'del') { $obj->delete($request->get('id')); } $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_allowed_to_edit(true) || api_is_drh(); //5. Querying the DB for the elements $columns = array(); switch ($action) { case 'get_questions': $columns = \Question::getQuestionColumns(api_get_course_id(), $extra_fields, $questionFields, true); $columns = $columns['simple_column_name']; $result = \Question::getQuestions($app, $categoryId, $exerciseId, $courseId, array('where' => $where_condition, 'order' => "{$sidx} {$sord}", 'extra' => $extra_fields, 'question' => $questionFields, 'limit' => "{$start} , {$limit}")); //var_dump($result); break; case 'get_user_list_plugin_widescale': $columns = array('username', 'firstname', 'lastname', 'exam_password'); $column_names = array(get_lang('Username'), get_lang('Firstname'), get_lang('Lastname'), get_lang('Password')); $result = \UserManager::get_user_data($start, $limit, $sidx, $sord); break; case 'get_question_list': if (isset($exercise) && !empty($exercise)) { $columns = array('question', 'type', 'category', 'level', 'score', 'actions'); $result = $exercise->getQuestionListPagination($start, $limit, $sidx, $sord, $where_condition); } break; case 'get_group_reporting': $columns = array('name', 'time', 'progress', 'score', 'works', 'messages', 'actions'); $result = \Tracking::get_group_reporting($course_id, $group_id, 'all', $start, $limit, $sidx, $sord, $where_condition); break; case 'get_course_exercise_medias': $columns = array('question'); $result = \Question::get_course_medias($course_id, $start, $limit, $sidx, $sord, $where_condition); if (!empty($result)) { foreach ($result as &$media) { $media['id'] = $media['iid']; } } break; case 'get_user_course_report_resumed': $columns = array('extra_ruc', 'training_hours', 'count_users', 'count_users_registered', 'average_hours_per_user', 'count_certificates'); $column_names = array(get_lang('Company'), get_lang('TrainingHoursAccumulated'), get_lang('CountOfSubscriptions'), get_lang('CountOfUsers'), get_lang('AverageHoursPerStudent'), get_lang('CountCertificates')); $result = \CourseManager::get_user_list_from_course_code(null, null, "LIMIT {$start}, {$limit}", " {$sidx} {$sord}", null, null, true, true, 'ruc'); $new_result = array(); if (!empty($result)) { foreach ($result as $row) { $row['training_hours'] = api_time_to_hms($row['training_hours']); $row['average_hours_per_user'] = api_time_to_hms($row['average_hours_per_user']); $new_result[] = $row; } $result = $new_result; } break; case 'get_user_course_report': $columns = array('course', 'user', 'time', 'certificate', 'progress_100', 'progress'); $column_names = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('CertificateGenerated'), get_lang('Approved'), get_lang('CourseAdvance')); $extra_fields = \UserManager::get_extra_fields(0, 100, null, null, true, true); if (!empty($extra_fields)) { foreach ($extra_fields as $extra) { $columns[] = $extra['1']; $column_names[] = $extra['3']; } } $result = \CourseManager::get_user_list_from_course_code(null, null, "LIMIT {$start}, {$limit}", " {$sidx} {$sord}", null, null, true); break; case 'get_user_skill_ranking': $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank'); $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $where_condition); $result = \ArrayClass::msort($result, 'skills_acquired', 'asc'); $skills_in_course = array(); if (!empty($result)) { //$counter = 1; foreach ($result as &$item) { $user_info = api_get_user_info($item['user_id']); $personal_course_list = \UserManager::get_personal_session_course_list($item['user_id']); $count_skill_by_course = array(); foreach ($personal_course_list as $course_item) { if (!isset($skills_in_course[$course_item['code']])) { $count_skill_by_course[$course_item['code']] = $skill->get_count_skills_by_course($course_item['code']); $skills_in_course[$course_item['code']] = $count_skill_by_course[$course_item['code']]; } else { $count_skill_by_course[$course_item['code']] = $skills_in_course[$course_item['code']]; } } $item['photo'] = \Display::img($user_info['avatar_small']); $item['currently_learning'] = !empty($count_skill_by_course) ? array_sum($count_skill_by_course) : 0; } } break; case 'get_work_user_list': if (isset($type) && $type == 'simple') { $columns = array('type', 'firstname', 'lastname', 'username', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'); } else { $columns = array('type', 'firstname', 'lastname', 'username', 'title', 'sent_date', 'actions'); } $result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition); break; case 'get_exercise_results': $course = api_get_course_info(); //used inside get_exam_results_data() $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document"; if ($is_allowedToEdit) { $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score', 'status', 'lp', 'actions'); } else { //$columns = array('exe_duration', 'start_date', 'exe_date', 'score', 'status', 'actions'); } $result = \ExerciseLib::get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition); break; case 'get_hotpotatoes_exercise_results': $course = api_get_course_info(); //used inside get_exam_results_data() $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document"; $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions'); $result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $where_condition); //get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition); break; case 'get_sessions': $session_columns = \SessionManager::get_session_columns($list_type); $columns = $session_columns['simple_column_name']; if ($list_type == 'simple') { $result = SessionManager::get_sessions_admin(array('where' => $where_condition, 'order' => "{$sidx} {$sord}", 'extra' => $extra_fields, 'limit' => "{$start} , {$limit}"), false); } else { $result = SessionManager::get_sessions_admin_complete(array('where' => $where_condition, 'order' => "{$sidx} {$sord}", 'extra' => $extra_fields, 'limit' => "{$start} , {$limit}")); } break; case 'get_timelines': $columns = array('headline', 'actions'); //$columns = array('headline', 'type', 'start_date', 'end_date', 'text', 'media', 'media_credit', 'media_caption', 'title_slide', 'parent_id'); if (!in_array($sidx, $columns)) { $sidx = 'headline'; } $course_id = api_get_course_int_id(); $result = Database::select('*', $obj->table, array('where' => array('parent_id = ? AND c_id = ?' => array('0', $course_id)), 'order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); foreach ($result as $item) { if (!$item['status']) { $item['name'] = '<font style="color:#AAA">' . $item['name'] . '</font>'; } $item['headline'] = Display::url($item['headline'], api_get_path(WEB_CODE_PATH) . 'timeline/view.php?id=' . $item['id']); $item['actions'] = Display::url(Display::return_icon('add.png', get_lang('AddItems')), api_get_path(WEB_CODE_PATH) . 'timeline/?action=add_item&parent_id=' . $item['id']); $item['actions'] .= Display::url(Display::return_icon('edit.png', get_lang('Edit')), api_get_path(WEB_CODE_PATH) . 'timeline/?action=edit&id=' . $item['id']); $item['actions'] .= Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_path(WEB_CODE_PATH) . 'timeline/?action=delete&id=' . $item['id']); $new_result[] = $item; } $result = $new_result; break; case 'get_gradebooks': $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates'); if (!in_array($sidx, $columns)) { $sidx = 'name'; } $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); foreach ($result as $item) { if ($item['parent_id'] != 0) { continue; } $skills = $obj->get_skills_by_gradebook($item['id']); //Fixes bug when gradebook doesn't have names if (empty($item['name'])) { $item['name'] = $item['course_code']; } else { //$item['name'] = $item['name'].' ['.$item['course_code'].']'; } $item['name'] = Display::url($item['name'], api_get_path(WEB_CODE_PATH) . 'gradebook/index.php?id_session=0&cidReq=' . $item['course_code']); if (!empty($item['certif_min_score']) && !empty($item['document_id'])) { $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), ICON_SIZE_SMALL); $item['has_certificates'] = '1'; } else { $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL); $item['has_certificates'] = '0'; } if (!empty($skills)) { foreach ($skills as $skill) { $item['skills'] .= Display::span($skill['name'], array('class' => 'label_tag skill')); } } $new_result[] = $item; } $result = $new_result; break; case 'get_event_email_template': $columns = array('subject', 'event_type_name', 'language_id', 'activated', 'actions'); if (!in_array($sidx, $columns)) { $sidx = 'subject'; } $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); foreach ($result as $item) { $language_info = api_get_language_info($item['language_id']); $item['language_id'] = $language_info['english_name']; $item['actions'] = Display::url(Display::return_icon('edit.png', get_lang('Edit')), api_get_path(WEB_CODE_PATH) . 'admin/event_type.php?action=edit&event_type_name=' . $item['event_type_name']); $item['actions'] .= Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_path(WEB_CODE_PATH) . 'admin/event_controller.php?action=delete&id=' . $item['id']); /*if (!$item['status']) { $item['name'] = '<font style="color:#AAA">'.$item['subject'].'</font>'; }*/ $new_result[] = $item; } $result = $new_result; break; case 'get_careers': $columns = array('name', 'description', 'actions'); if (!in_array($sidx, $columns)) { $sidx = 'name'; } $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); foreach ($result as $item) { if (!$item['status']) { $item['name'] = '<font style="color:#AAA">' . $item['name'] . '</font>'; } $new_result[] = $item; } $result = $new_result; break; case 'get_promotions': $columns = array('name', 'career', 'description', 'actions'); if (!in_array($sidx, $columns)) { $sidx = 'name'; } $result = Database::select('p.id,p.name, p.description, c.name as career, p.status', "{$obj->table} p LEFT JOIN " . Database::get_main_table(TABLE_CAREER) . " c ON c.id = p.career_id ", array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); foreach ($result as $item) { if (!$item['status']) { $item['name'] = '<font style="color:#AAA">' . $item['name'] . '</font>'; } $new_result[] = $item; } $result = $new_result; break; case 'get_grade_models': $columns = array('name', 'description', 'actions'); if (!in_array($sidx, $columns)) { $sidx = 'name'; } $result = Database::select('*', "{$obj->table} ", array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); foreach ($result as $item) { $new_result[] = $item; } $result = $new_result; break; case 'get_usergroups': $columns = array('name', 'users', 'courses', 'sessions', 'group_type', 'actions'); $result = Database::select('*', $obj->table, array('order' => "name {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); if (!empty($result)) { foreach ($result as $group) { $group['sessions'] = count($obj->get_sessions_by_usergroup($group['id'])); $group['courses'] = count($obj->get_courses_by_usergroup($group['id'])); $group['users'] = count($obj->get_users_by_usergroup($group['id'])); switch ($group['group_type']) { case '0': $group['group_type'] = Display::label(get_lang('Class'), 'info'); break; case '1': $group['group_type'] = Display::label(get_lang('Social'), 'success'); break; } $new_result[] = $group; } $result = $new_result; } $columns = array('name', 'users', 'courses', 'sessions', 'group_type'); if (!in_array($sidx, $columns)) { $sidx = 'name'; } //Multidimensional sort ArrayClass::msort($result, $sidx); break; case 'get_extra_fields': $obj = new \ExtraField($type); $columns = array('field_display_text', 'field_variable', 'field_type', 'field_changeable', 'field_visible', 'field_filter', 'field_order'); $result = \Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); $new_result = array(); if (!empty($result)) { foreach ($result as $item) { $item['field_type'] = $obj->get_field_type_by_id($item['field_type']); $item['field_changeable'] = $item['field_changeable'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif'); $item['field_visible'] = $item['field_visible'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif'); $item['field_filter'] = $item['field_filter'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif'); $new_result[] = $item; } $result = $new_result; } break; case 'get_extra_field_options': $obj = new \ExtraFieldOption($type); $columns = array('option_display_text', 'option_value', 'option_order'); $result = \Database::select('*', $obj->table, array('where' => array("field_id = ? " => $field_id), 'order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}")); /*$new_result = array(); if (!empty($result)) { foreach ($result as $item) { $item['field_type'] = $obj->get_field_type_by_id($item['field_type']); $item['field_changeable'] = $item['field_changeable'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif'); $item['field_visible'] = $item['field_visible'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif'); $item['field_filter'] = $item['field_filter'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif'); $new_result[] = $item; } $result = $new_result; }*/ break; case 'get_usergroups_teacher': $columns = array('name', 'users', 'actions'); $options = array('order' => "name {$sord}", 'LIMIT' => "{$start} , {$limit}"); $options['course_id'] = $course_id; switch ($type) { case 'not_registered': $options['where'] = array(" (course_id IS NULL OR course_id != ?) " => $course_id); $result = $obj->get_usergroup_not_in_course($options); break; case 'registered': $options['where'] = array(" usergroup.course_id = ? " => $course_id); $result = $obj->get_usergroup_in_course($options); break; } $new_result = array(); if (!empty($result)) { foreach ($result as $group) { $group['users'] = count($obj->get_users_by_usergroup($group['id'])); if ($obj->usergroup_was_added_in_course($group['id'], $course_id)) { $url = 'class.php?action=remove_class_from_course&id=' . $group['id']; $icon = Display::return_icon('delete.png', get_lang('Remove')); } else { $url = 'class.php?action=add_class_to_course&id=' . $group['id']; $icon = Display::return_icon('add.png', get_lang('Add')); } $group['actions'] = Display::url($icon, $url); $new_result[] = $group; } $result = $new_result; } if (!in_array($sidx, $columns)) { $sidx = 'name'; } //Multidimensional sort \ArrayClass::msort($result, $sidx); break; default: exit; } $allowed_actions = array('get_careers', 'get_promotions', 'get_usergroups', 'get_usergroups_teacher', 'get_gradebooks', 'get_sessions', 'get_exercise_results', 'get_hotpotatoes_exercise_results', 'get_work_user_list', 'get_timelines', 'get_grade_models', 'get_event_email_template', 'get_user_skill_ranking', 'get_extra_fields', 'get_extra_field_options', 'get_course_exercise_medias', 'get_user_course_report', 'get_user_course_report_resumed', 'get_group_reporting', 'get_question_list', 'get_user_list_plugin_widescale', 'get_questions'); //5. Creating an obj to return a json if (in_array($action, $allowed_actions)) { $response = new \stdClass(); $response->page = $page; $response->total = $total_pages; $response->records = $count; if ($operation && $operation == 'excel') { $j = 1; $array = array(); if (empty($column_names)) { $column_names = $columns; } //Headers foreach ($column_names as $col) { $array[0][] = $col; } foreach ($result as $row) { foreach ($columns as $col) { $array[$j][] = strip_tags($row[$col]); } $j++; } switch ($export_format) { case 'xls': Export::export_table_xls($array, 'company_report'); break; case 'csv': default: Export::export_table_csv($array, 'company_report'); break; } exit; } $i = 0; if (!empty($result)) { foreach ($result as $row) { //print_r($row); // if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235 if (!isset($row['id']) || isset($row['id']) && $row['id'] == "") { $response->rows[$i]['id'] = $i; } else { $response->rows[$i]['id'] = $row['id']; } $array = array(); foreach ($columns as $col) { $array[] = isset($row[$col]) ? $row[$col] : null; } $response->rows[$i]['cell'] = $array; $i++; } } return json_encode($response); } }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Simple Timeline</title> <link rel="stylesheet" href="timeline.css"> </head> <body> <?php include 'timeline.php'; $timeline = new Timeline(); ?> <div> <a href="index.php"><h1>Simple Timeline</h1></a> <div class="search"> <!-- Ex 3: Modify forms --> <form class="search-form" action="index.php" method="get"> <input type="submit" value="search"> <input type="text" name="query" placeholder="Search"> <select name="type"> <option value="author">Author</option> <option value="contents">Content</option> </select> </form> </div> <div class="panel"> <div class="panel-heading"> <!-- Ex 3: Modify forms --> <form class="write-form" action="add.php" method="post"> <input type="text" placeholder="Author" name="author"> <div>
<?php error_reporting(E_ALL); ini_set('display_errors', 1); require_once '../../framework/Company.php'; require_once '../../framework/User.php'; require_once '../../framework/Timeline.php'; $mUser = User::getCurrentUser(); $mCompany = new Company($mUser->getCompany()); $mTimelineResourceList = array(); $mTimelineList = $mCompany->getTimeline(); //echo sizeof($mTimelineList); for ($i = 0; $i < sizeof($mTimelineList); $i++) { $tl = new Timeline($mTimelineList[$i]); $temp = $tl->getResource(); //echo $temp['type']; array_push($mTimelineResourceList, $temp); } echo json_encode($mTimelineResourceList);
/** * Create Image Timeline for Dashboard * * @return image */ function timelineDashboardAction() { // workaround for unit tests 'Action Helper by name Layout not found' if ($this->_helper->hasHelper('layout')) { $this->_helper->layout->disableLayout(); // disable layouts } // http://localhost/webacula/chart/timeline/datetimeline/2010-01-08 // check GD lib (php-gd) if (!extension_loaded('gd')) { // No GD lib (php-gd) found $this->view->result = null; return; } $timeline = new Timeline(); $img = $timeline->createTimelineImage(date('Y-m-d', time()), true, $this->view->translate, 'small'); // Set the headers $this->getResponse()->setHeader('Content-Type', 'image/png'); // Output a PNG image to either the browser or a file : // bool imagepng ( resource image [, string filename [, int quality [, int filters]]] ) $res = imagepng($img, null, 5); }
</form> </div> <div class="panel"> <div class="panel-heading"> <form class="write-form" action="add.php" method="post"> <input type="text" placeholder="Author" name="author"> <div> <input type="text" placeholder="Content" name="content"> </div> <input type="submit" value="write"> </form> </div> <div class="tweet"> <?php $temp; $timeline = new Timeline(); if (isset($_GET["type"]) && isset($_GET["query"]) && $_GET["type"] != "" && $_GET["query"] != "") { $temp = $timeline->searchTweets($_GET["type"], $_GET["query"]); } else { $temp = $timeline->loadTweets(); } foreach ($temp as $row) { $content = $row['content']; $replace = preg_replace_callback("/#[^\\s#]+/", create_function('$matches', '$tag = substr($matches[0], 1);return "<a href=index.php?type=content&query=$tag>$matches[0]</a>";'), $content); ?> <form class="delete-form" action="delete.php" method="post" > <input type="submit" value="delete"> <input type="hidden" name="no" value=<?php echo $row['no']; ?> >
$columns = array(get_lang('Name'), get_lang('Actions')); //Column config $column_model = array(array('name' => 'name', 'index' => 'name', 'width' => '120', 'align' => 'left'), array('name' => 'actions', 'index' => 'actions', 'width' => '100', 'align' => 'left', 'sortable' => 'false')); //Autowidth $extra_params['autowidth'] = 'true'; //height auto $extra_params['height'] = 'auto'; //With this function we can add actions to the jgrid (edit, delete, etc) $htmlHeadXtra[] = ' <script> $(function() { // grid definition see the $timeline->display() function ' . Display::grid_js('timelines', $url, $columns, $column_model, $extra_params, array(), null, true) . ' }); </script>'; $timeline = new Timeline(); // Action handling: Add switch ($action) { case 'add': if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } $url = api_get_self() . '?action=' . Security::remove_XSS($_GET['action']); $form = $timeline->return_form($url, 'add'); // The validation or display if ($form->validate()) { if ($check) { $values = $form->exportValues(); $res = $timeline->save($values); if ($res) { $message = Display::return_message(get_lang('ItemAdded'), 'success');