コード例 #1
0
ファイル: exercise.php プロジェクト: hemsinfotech/kodelearn
 /**
  * Action to show the list of exercises
  */
 public function action_index()
 {
     $view = View::factory('exercise/list')->bind('table', $table)->bind('course', $course)->bind('links', $links)->set('success', Session::instance()->get_once('success', ''));
     $course = ORM::factory('course', Session::instance()->get('course_id'));
     $exercises = ORM::factory('exercise')->where('course_id', ' = ', $course->id)->order_by('created_at', 'DESC')->find_all();
     $links = array('add' => Html::anchor('/exercise/add/', 'Create an Exercise', array('class' => 'createButton l')), 'delete' => URL::site('/exercise/delete/'));
     $sortables = new Sort(array('Title' => '', 'Type' => '', 'Questions' => array('sort' => '', 'attributes' => array('class' => 'tac')), 'Marks' => array('sort' => '', 'attributes' => array('class' => 'tac')), 'Status' => array('sort' => '', 'attributes' => array('class' => 'tac')), 'Attempts' => '', 'Actions' => array('sort' => '', 'attributes' => array('class' => 'tac'))));
     $headings = $sortables->render();
     $table = array('headings' => $headings, 'data' => $exercises, 'total' => $exercises->count());
     $this->content = $view;
 }
コード例 #2
0
ファイル: room.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     $msg = $this->request->param('msg');
     if ($this->request->param('sort')) {
         $sort = $this->request->param('sort');
     } else {
         $sort = 'room_name';
     }
     if ($this->request->param('order')) {
         $order = $this->request->param('order');
     } else {
         $order = 'DESC';
     }
     $filters = array('filter_room_name' => $this->request->param('filter_room_name'), 'filter_number' => $this->request->param('filter_number'), 'filter_location' => $this->request->param('filter_location'));
     $total = Model_Room::rooms_total($filters);
     $count = $total;
     $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
     $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
     $rooms = Model_Room::rooms($filters);
     $sorting = new Sort(array('Name' => 'room_name', 'Number' => 'room_number', 'Location' => 'name', 'Action' => ''));
     $url = 'room/index';
     if ($this->request->param('filter_room_name')) {
         $url .= '/filter_room_name/' . $this->request->param('filter_room_name');
         $filter = $this->request->param('filter_room_name');
         $filter_select = 'filter_room_name';
     }
     if ($this->request->param('filter_number')) {
         $url .= '/filter_number/' . $this->request->param('filter_number');
         $filter = $this->request->param('filter_number');
         $filter_select = 'filter_number';
     }
     if ($this->request->param('filter_location')) {
         $url .= '/filter_location/' . $this->request->param('filter_location');
         $filter = $this->request->param('filter_location');
         $filter_select = 'filter_location';
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     $links = array('add_room' => Html::anchor('/room/add/', 'Create a Room', array('class' => 'createButton l')), 'locations' => Html::anchor('/location', 'Locations', array('class' => 'pageAction l')), 'delete' => URL::site('/room/delete/'));
     $table = array('heading' => $heading, 'data' => $rooms);
     // Render the pagination links
     $pagination = $pagination->render();
     $filter_room_name = $this->request->param('filter_room_name');
     $filter_url = URL::site('room/index');
     $view = View::factory('room/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('msg', $msg);
     Breadcrumbs::add(array('System', Url::site('system')));
     Breadcrumbs::add(array('Room', Url::site('room')));
     $this->content = $view;
 }
コード例 #3
0
ファイル: course.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     $sort = $this->request->param('sort', 'name');
     $order = $this->request->param('order', 'ASC');
     Session::instance()->delete('course_id');
     $criteria = array('user' => Acl::instance()->relevant_user(), 'filters' => array('name' => $this->request->param('filter_name'), 'access_code' => $this->request->param('filter_access_code'), 'start_date' => $this->request->param('filter_start_date'), 'end_date' => $this->request->param('filter_end_date')));
     $total = Model_Course::courses_total($criteria);
     $pagination = Pagination::factory(array('total_items' => $total, 'items_per_page' => 5));
     $criteria = array_merge($criteria, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
     $courses = Model_Course::courses($criteria);
     $sorting = new Sort(array('Course' => 'name', 'Access Code' => 'access_code', 'Start Date' => 'start_date', 'End Date' => 'end_date', 'Actions' => ''));
     $url = 'course/index';
     if ($this->request->param('filter_name')) {
         $url .= '/filter_name/' . $this->request->param('filter_name');
         $filter = $this->request->param('filter_name');
         $filter_select = 'filter_name';
     }
     if ($this->request->param('filter_access_code')) {
         $url .= '/filter_access_code/' . $this->request->param('filter_access_code');
         $filter = $this->request->param('filter_access_code');
         $filter_select = 'filter_access_code';
     }
     if ($this->request->param('filter_start_date')) {
         $url .= '/filter_start_date/' . $this->request->param('filter_start_date');
         $filter = $this->request->param('filter_start_date');
         $filter_select = 'filter_start_date';
     }
     if ($this->request->param('filter_end_date')) {
         $url .= '/filter_end_date/' . $this->request->param('filter_end_date');
         $filter = $this->request->param('filter_end_date');
         $filter_select = 'filter_end_date';
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     // Render the pagination links
     $pagination = $pagination->render();
     $links = array('add' => Html::anchor('/course/add/', 'Create a course', array('class' => 'createButton l')), 'delete' => URL::site('/course/delete/'), 'join' => Html::anchor('/course/join/', 'Join Course', array('class' => 'pageAction c')));
     $table = array('heading' => $heading, 'data' => $courses);
     $filter_name = $this->request->param('filter_name');
     $filter_access_code = $this->request->param('filter_access_code');
     $filter_start_date = $this->request->param('filter_start_date');
     $filter_end_date = $this->request->param('filter_end_date');
     $filter_url = URL::site('course/index');
     $success = Session::instance()->get('success');
     Session::instance()->delete('success');
     $view = View::factory('course/list')->bind('table', $table)->bind('count', $total)->bind('links', $links)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success);
     Breadcrumbs::add(array('Courses', Url::site('course')));
     $this->content = $view;
 }
コード例 #4
0
ファイル: examgroup.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     $msg = $this->request->param('msg');
     if ($this->request->param('sort')) {
         $sort = $this->request->param('sort');
     } else {
         $sort = 'name';
     }
     if ($this->request->param('order')) {
         $order = $this->request->param('order');
     } else {
         $order = 'DESC';
     }
     $examgroup = ORM::factory('examgroup');
     if ($this->request->param('filter_name')) {
         $examgroup->where('name', 'LIKE', '%' . $this->request->param('filter_name') . '%');
     }
     $count = $examgroup->count_all();
     $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
     $examgroup->select('name');
     if ($this->request->param('filter_name')) {
         $examgroup->where('name', 'LIKE', '%' . $this->request->param('filter_name') . '%');
     }
     $examgroup->group_by('id')->order_by($sort, $order)->limit($pagination->items_per_page)->offset($pagination->offset);
     $examgroups = $examgroup->find_all();
     $sorting = new Sort(array('Name' => 'name', 'Action' => ''));
     $url = 'examgroup/index';
     if ($this->request->param('filter_name')) {
         $url .= '/filter_name/' . $this->request->param('filter_name');
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     $links = array('add_examgroup' => Html::anchor('/examgroup/add/', 'Create a Grading Period', array('class' => 'createButton l')), 'delete' => URL::site('/examgroup/delete/'));
     $table = array('heading' => $heading, 'data' => $examgroups);
     // Render the pagination links
     $pagination = $pagination->render();
     $filter_name = $this->request->param('filter_name');
     $filter_url = URL::site('examgroup/index');
     $success = Session::instance()->get('success');
     Session::instance()->delete('success');
     $view = View::factory('examgroup/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter_name', $filter_name)->bind('filter_url', $filter_url)->bind('msg', $msg)->bind('success', $success);
     Breadcrumbs::add(array('Exams', Url::site('exam')));
     Breadcrumbs::add(array('Grading Period', Url::site('examgroup')));
     $this->content = $view;
 }
コード例 #5
0
ファイル: location.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     $msg = $this->request->param('msg');
     if ($this->request->param('sort')) {
         $sort = $this->request->param('sort');
     } else {
         $sort = 'name';
     }
     if ($this->request->param('order')) {
         $order = $this->request->param('order');
     } else {
         $order = 'DESC';
     }
     $location = ORM::factory('location');
     if ($this->request->param('filter_name')) {
         $location->where('locations.name', 'LIKE', '%' . $this->request->param('filter_name') . '%');
     }
     $count = $location->count_all();
     $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
     $location->select(array('count("rooms.location_id")', 'room_count'))->join('rooms', 'left')->on('locations.id', '=', 'rooms.location_id');
     if ($this->request->param('filter_name')) {
         $location->where('locations.name', 'LIKE', '%' . $this->request->param('filter_name') . '%');
     }
     $location->group_by('locations.id')->order_by($sort, $order)->limit($pagination->items_per_page)->offset($pagination->offset);
     $locations = $location->find_all();
     $sorting = new Sort(array('Location' => 'name', 'Map' => '', 'No of Rooms' => 'room_count', 'Actions' => ''));
     $url = 'location/index';
     if ($this->request->param('filter_name')) {
         $url .= '/filter_name/' . $this->request->param('filter_name');
         $filter = $this->request->param('filter_name');
         $filter_select = 'filter_name';
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     $links = array('add_location' => Html::anchor('/location/add/', 'Create a location', array('class' => 'createButton l')), 'rooms' => Html::anchor('/room', 'Rooms', array('class' => 'pageAction l')), 'delete' => URL::site('/location/delete/'));
     $table = array('heading' => $heading, 'data' => $locations);
     // Render the pagination links
     $pagination = $pagination->render();
     $filter_name = $this->request->param('filter_name');
     $filter_url = URL::site('location/index');
     $view = View::factory('location/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('msg', $msg);
     Breadcrumbs::add(array('System', Url::site('system')));
     Breadcrumbs::add(array('Location', Url::site('location')));
     $this->content = $view;
 }
コード例 #6
0
ファイル: batch.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     if ($this->request->param('sort')) {
         $sort = $this->request->param('sort');
     } else {
         $sort = 'name';
     }
     if ($this->request->param('order')) {
         $order = $this->request->param('order');
     } else {
         $order = 'DESC';
     }
     $batch = ORM::factory('batch');
     if ($this->request->param('filter_name')) {
         $batch->where('batches.name', 'LIKE', '%' . $this->request->param('filter_name') . '%');
     }
     $count = $batch->count_all();
     $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
     $batch->select(array('COUNT("batches_users.user_id")', 'users'))->join('batches_users', 'left')->on('batches_users.batch_id', '=', 'batches.id');
     if ($this->request->param('filter_name')) {
         $batch->where('batches.name', 'LIKE', '%' . $this->request->param('filter_name') . '%');
     }
     $batch->group_by('batches.id')->order_by($sort, $order)->limit($pagination->items_per_page)->offset($pagination->offset);
     $batches = $batch->find_all();
     $sorting = new Sort(array('Batch' => 'name', 'No. of Students' => 'users', 'Actions' => ''));
     $url = 'batch/index';
     $filter = array('text' => '', 'select' => '');
     if ($this->request->param('filter_name')) {
         $url .= '/filter_name/' . $this->request->param('filter_name');
         $filter = array('text' => $this->request->param('filter_name'), 'select' => 'filter_name');
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     $links = array('add_batch' => Html::anchor('/batch/add/', 'Create a batch', array('class' => 'createButton l')), 'delete' => URL::site('/batch/delete/'));
     $table = array('heading' => $heading, 'data' => $batches);
     // Render the pagination links
     $pagination = $pagination->render();
     $filter['url'] = URL::site('batch/index');
     $view = View::factory('batch/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter', $filter)->bind('success', $success);
     $success = Session::instance()->get('success');
     Session::instance()->delete('success');
     Breadcrumbs::add(array('Batches', Url::site('batch')));
     $this->content = $view;
 }
コード例 #7
0
 public function decanding()
 {
     $sorting_info = Sort::columns('shortages');
     $this->db->select("*");
     $this->helper_model->search("Shortages_Search_Form", "shortages");
     $this->helper_model->sort($sorting_info);
     return $this->db->get('decanding_shortages_view')->result();
 }
コード例 #8
0
ファイル: SortTest.php プロジェクト: hemsinfotech/kodelearn
 public function test_render()
 {
     $sorting = new Sort(array('Column1' => ''));
     $sorting->set_order('ASC');
     //testing with checkbox column true
     $html = '<tr><th><input type="checkbox" onclick="$(\'.selected\').attr(\'checked\', this.checked);"/></th><th>Column1</th></tr>';
     $this->assertEquals($html, $sorting->render());
     //testing with checkbox column false
     $sorting->set_check_box_column(FALSE);
     $html = '<tr><th>Column1</th></tr>';
     $this->assertEquals($html, $sorting->render());
     //testing with attributes
     $sorting = new Sort(array('Column1' => array('sort' => '', 'attributes' => array('width' => 150))));
     $sorting->set_order('ASC');
     //testing with checkbox column true
     $html = '<tr><th><input type="checkbox" onclick="$(\'.selected\').attr(\'checked\', this.checked);"/></th><th width="150">Column1</th></tr>';
     $this->assertEquals($html, $sorting->render());
 }
コード例 #9
0
ファイル: question.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     $view = View::factory('question/list')->bind('table', $table)->bind('total', $total)->bind('links', $links)->bind('success', $success)->bind('filter_url', $filter_url)->bind('filter_type', $filter_type)->bind('types', $types);
     $filter_type = (string) $this->request->param('filter_type', '');
     $course_id = Session::instance()->get('course_id');
     $course = ORM::factory('course', (int) $course_id);
     $criteria = array('filter_type' => $this->request->param('filter_type', ''), 'course_id' => $course_id);
     $questions = Model_Question::get_questions($criteria);
     $total = Model_Question::get_total_question_count($criteria);
     $sortables = new Sort(array('Question' => '', 'Type' => '', 'Actions' => ''));
     $headings = $sortables->render();
     $table = array('headings' => $headings, 'data' => $questions);
     $types = array_combine(Model_Question::$TYPES, array_map('ucfirst', Model_Question::$TYPES));
     $filter_url = URL::site('question/index');
     $links = array('add' => Html::anchor('/question/add/', 'Create a question', array('class' => 'createButton l')), 'delete' => URL::site('/question/delete/'));
     $success = Session::instance()->get_once('success');
     $this->content = $view;
 }
コード例 #10
0
ファイル: link.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     $sort = $this->request->param('sort', 'title');
     $order = $this->request->param('order', 'ASC');
     //Session::instance()->delete('course_id');
     $criteria = array('filters' => array('title' => $this->request->param('filter_title'), 'description' => $this->request->param('filter_description')));
     $total = Model_Link::link_total($criteria);
     $pagination = Pagination::factory(array('total_items' => $total, 'items_per_page' => 5));
     $criteria = array_merge($criteria, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
     $links = Model_Link::links($criteria);
     $sorting = new Sort(array('Title' => 'title', 'Description' => 'description', 'No Of Questions' => '', 'Actions' => ''));
     $url = 'link/index';
     if ($this->request->param('filter_title')) {
         $url .= '/filter_title/' . $this->request->param('filter_title');
         $filter = $this->request->param('filter_title');
         $filter_select = 'filter_title';
     }
     if ($this->request->param('filter_description')) {
         $url .= '/filter_description/' . $this->request->param('filter_description');
         $filter = $this->request->param('filter_description');
         $filter_select = 'filter_description';
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     // Render the pagination links
     $pagination = $pagination->render();
     $links_old = array('delete' => URL::site('/link/delete/'), 'edit' => URL::site('/link/edit/'));
     $table = array('data' => $links);
     $filter_title = $this->request->param('filter_title');
     $filter_description = $this->request->param('filter_description');
     $filter_url = URL::site('link/index');
     $success = Session::instance()->get('success');
     Session::instance()->delete('success');
     $view = View::factory('link/list')->bind('table', $table)->bind('count', $total)->bind('links_old', $links_old)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success);
     $this->content = $view;
 }
コード例 #11
0
 public function search_limited_tankers($limit, $start, $where = "")
 {
     $sorting_info = Sort::columns('tankers');
     $this->db->select('*');
     $this->db->from('tankers_status_view');
     $this->helper_model->search("Tankers_Search_Form", "tankers");
     if ($where != "") {
         $this->db->where($where);
     }
     $this->helper_model->sort($sorting_info);
     $this->db->limit($limit, $start);
     $result = $this->db->get()->result();
     return $result;
 }
コード例 #12
0
ファイル: index.blade.php プロジェクト: devisephp/cms
?>
                    <input type="checkbox" name="show_admin" value="true" <?php 
echo Input::get('show_admin') === 'true' ? 'checked' : '';
?>
>
                </th>
				<th>
                    <div class="dvs-inline-block dvs-button-group dvs-sort-group dvs-pr">
                        <?php 
echo Sort::link('slug', 'Path', array('class' => 'dvs-button dvs-button-small dvs-button-outset'));
?>
                        <?php 
echo Sort::link('title', 'Page Name', array('class' => 'dvs-button dvs-button-small dvs-button-outset'));
?>
                        <?php 
echo Sort::clearSortLink('Clear Sort', array('class' => 'dvs-button dvs-button-small dvs-button-outset'));
?>
                    </div>
                </th>
			</tr>
		</thead>

		<tbody id="pages">
			@foreach($pages as $page)
				<tr>
					<td class="dvs-stacked-col dvs-tal">
                        <div><?php 
echo HTML::showPagesWithRequestedContent($page);
echo $page->title;
?>
</div>
コード例 #13
0
ファイル: user.php プロジェクト: hemsinfotech/kodelearn
 public function action_index()
 {
     if ($this->request->param('sort')) {
         $sort = $this->request->param('sort');
     } else {
         $sort = 'id';
     }
     if ($this->request->param('order')) {
         $order = $this->request->param('order');
     } else {
         $order = 'DESC';
     }
     if ($this->request->param('filter_batch')) {
         $filters = array('filter_batch' => $this->request->param('filter_batch'));
         $total = Model_User::users_total_batch($filters);
         $count = $total;
         $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50));
         $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
         $users = Model_User::users_batch($filters);
     } else {
         if ($this->request->param('filter_course')) {
             $filters = array('filter_course' => $this->request->param('filter_course'));
             $total = Model_User::users_total_course($filters);
             $count = $total;
             $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50));
             $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
             $users = Model_User::users_course($filters);
         } else {
             if ($this->request->param('filter_role')) {
                 $filters = array('filter_role' => $this->request->param('filter_role'));
                 $total = Model_User::users_total_role($filters);
                 $count = $total;
                 $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50));
                 $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
                 $users = Model_User::users_role($filters);
             } else {
                 $filters = array('filter_id' => $this->request->param('filter_id'), 'filter_name' => $this->request->param('filter_name'), 'filter_approved' => $this->request->param('filter_approved'));
                 $total = Model_User::users_total($filters);
                 $count = $total;
                 $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50));
                 $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
                 $users = Model_User::users($filters);
             }
         }
     }
     $sorting = new Sort(array('Roll No' => 'id', 'Name' => array('sort' => 'firstname', 'attributes' => array('width' => 330)), 'Batch' => array('sort' => '', 'attributes' => array('width' => 140)), 'Courses' => array('sort' => '', 'attributes' => array('width' => 140)), 'Approved' => array('sort' => 'status', 'attributes' => array('width' => 140)), 'Actions' => ''));
     $url = 'user/index';
     if ($this->request->param('filter_name')) {
         $url .= '/filter_name/' . $this->request->param('filter_name');
         $filter = $this->request->param('filter_name');
         $filter_select = 'filter_name';
     }
     if ($this->request->param('filter_id')) {
         $url .= '/filter_id/' . $this->request->param('filter_id');
         $filter = $this->request->param('filter_id');
         $filter_select = 'filter_id';
     }
     if ($this->request->param('filter_batch')) {
         $url .= '/filter_batch/' . $this->request->param('filter_batch');
         $filter = $this->request->param('filter_batch');
         $filter_select = 'filter_batch';
     }
     if ($this->request->param('filter_course')) {
         $url .= '/filter_course/' . $this->request->param('filter_course');
         $filter = $this->request->param('filter_course');
         $filter_select = 'filter_course';
     }
     if ($this->request->param('filter_approved')) {
         $url .= '/filter_approved/' . $this->request->param('filter_approved');
         $filter = $this->request->param('filter_approved');
         $filter_select = 'filter_approved';
     }
     if ($this->request->param('filter_role')) {
         $url .= '/filter_role/' . $this->request->param('filter_role');
         $filter = $this->request->param('filter_role');
         $filter_select = 'filter_role';
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     $pagination = $pagination->render();
     $links = array('add' => Html::anchor('/user/add/', 'Create a user', array('class' => 'createButton l')), 'uploadcsv' => Html::anchor('/user/uploadcsv/', 'Upload CSV', array('class' => 'pageAction l')), 'roles' => Html::anchor('/role/', 'Manage Roles', array('class' => 'pageAction 1')), 'delete' => URL::site('/user/delete/'));
     $table['heading'] = $heading;
     $table['data'] = $users;
     $filter_url = URL::site('user/index');
     $cacheimage = CacheImage::instance();
     $success = Session::instance()->get('success');
     Session::instance()->delete('success');
     $view = View::factory('user/list')->bind('table', $table)->bind('users', $users)->bind('count', $count)->bind('links', $links)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('cacheimage', $cacheimage)->bind('success', $success);
     Breadcrumbs::add(array('User', Url::site('user')));
     $this->content = $view;
 }
コード例 #14
0
ファイル: BrowsePage.php プロジェクト: cebe/chive
    public function run()
    {
        $response = new AjaxResponse();
        $profiling = Yii::app()->user->settings->get('profiling');
        try {
            $sqlQuery = new SqlQuery($this->query);
        } catch (SQPException $ex) {
            $response->addNotification('error', Yii::t('core', 'errorExecuteQuery'), $ex->getMessage());
            $this->response = $response;
            return;
        }
        if (!$this->query) {
            $this->query = $this->getDefaultQuery();
            $queries = (array) $this->query;
        } else {
            if ($profiling) {
                $cmd = $this->db->createCommand('FLUSH STATUS');
                $cmd->execute();
                $cmd = $this->db->createCommand('SET PROFILING = 1');
                $cmd->execute();
            }
            $splitter = new SqlSplitter($this->query);
            $queries = $splitter->getQueries();
        }
        if ($this->execute) {
            $queryCount = count($queries);
            $i = 1;
            foreach ($queries as $query) {
                try {
                    $sqlQuery = new SqlQuery($query);
                } catch (SQPException $ex) {
                    $response->addNotification('error', Yii::t('core', 'errorExecuteQuery'), $ex->getMessage());
                    break;
                }
                $type = $sqlQuery->getType();
                $this->table = $sqlQuery->getTable();
                $this->tables = $sqlQuery->getTables();
                $this->singleTableSelect = count($this->tables) == 1;
                // SELECT
                if ($type == "select") {
                    // Pagination
                    $pages = new Pagination();
                    $pages->route = $this->route;
                    $pageSize = $pages->setupPageSize('pageSize', 'schema.table.browse');
                    // Sorting
                    $sort = new Sort($this->db);
                    $sort->multiSort = false;
                    $sort->route = $this->route;
                    $sqlQuery->applyCalculateFoundRows();
                    $limit = $sqlQuery->getLimit();
                    $order = $sqlQuery->getOrder();
                    // Apply sort
                    if ($sort->getOrder()) {
                        $sqlQuery->applySort($sort->getOrder(), true);
                    }
                    if (isset($_REQUEST['page'])) {
                        $offset = $_REQUEST['page'] * $pageSize - $pageSize;
                        $sqlQuery->applyLimit($pageSize, $offset, true);
                    }
                    // Set pagesize from query limit
                    if ($limit && !isset($_REQUEST[$pages->pageSizeVar])) {
                        $_REQUEST[$pages->pageSizeVar] = $limit['length'];
                        $pageSize = $pages->setupPageSize('pageSize', 'schema.table.browse');
                        $offset = $limit['start'];
                    } elseif (!$limit) {
                        $offset = 0;
                        $sqlQuery->applyLimit($pageSize, $offset, true);
                    } elseif (isset($_REQUEST[$pages->pageSizeVar])) {
                        $pageSize = $pages->setupPageSize('pageSize', 'schema.table.browse');
                        $offset = 0;
                        $sqlQuery->applyLimit($pageSize, $offset, true);
                    }
                    $this->start = (int) $offset;
                } elseif ($type == "insert" || $type == "update" || $type == "delete") {
                    #predie("insert / update / delete statement");
                    $response->refresh = true;
                } elseif ($type == "show") {
                    // show create table etc.
                } elseif ($type == "explain") {
                } elseif ($type == "analyze" || $type == "optimize" || $type == "repair" || $type == "check") {
                    // Table functions
                } elseif ($type == "use") {
                    $name = $sqlQuery->getDatabase();
                    if ($queryCount == 1 && $name && $this->schema != $name) {
                        $response->redirectUrl = Yii::app()->baseUrl . '/schema/' . $name . '#sql';
                        $response->addNotification('success', Yii::t('core', 'successChangeDatabase', array('{name}' => $name)));
                    }
                } elseif ($type == "create") {
                    $response->reload = true;
                } elseif ($type == "drop") {
                    $response->reload = true;
                }
                $this->executedQueries[] = $sqlQuery->getQuery();
                $this->originalQueries[] = $sqlQuery->getOriginalQuery();
                if ($type == "select") {
                    $pages->postVars = $sort->postVars = array('query' => $sqlQuery->getOriginalQuery());
                }
                // Prepare query for execution
                $cmd = $this->db->createCommand($sqlQuery->getQuery());
                $cmd->prepare();
                if ($this->hasResultSet = $sqlQuery->returnsResultSet() !== false) {
                    try {
                        // Fetch data
                        $start = microtime(true);
                        $data = $cmd->queryAll();
                        $time = round(microtime(true) - $start, 6);
                        SqlUtil::FixTable($data);
                        if ($type == 'select') {
                            $total = (int) $this->db->createCommand('SELECT FOUND_ROWS()')->queryScalar();
                            $pages->setItemCount($total);
                            $this->total = $total;
                            $keyData = array();
                        }
                        $columns = array();
                        // Fetch column headers
                        if (isset($data[0])) {
                            $columns = array_keys($data[0]);
                        }
                        $isSent = true;
                        $this->lastResultSetQuery = $sqlQuery->getOriginalQuery();
                    } catch (CDbException $ex) {
                        $ex = new DbException($cmd);
                        $response->addNotification('error', Yii::t('core', 'errorExecuteQuery'), $ex->getText(), $ex->getSql());
                    }
                } else {
                    try {
                        // Measure time
                        $start = microtime(true);
                        $result = $cmd->execute();
                        $time = round(microtime(true) - $start, 6);
                        $response->addNotification('success', Yii::t('core', 'successExecuteQuery'), Yii::t('core', 'affectedRowsQueryTime', array($result, '{rows}' => $result, '{time}' => $time)), $sqlQuery->getQuery());
                    } catch (CDbException $ex) {
                        $dbException = new DbException($cmd);
                        $response->addNotification('error', Yii::t('core', 'errorExecuteQuery'), Yii::t('core', 'sqlErrorOccured', array('{errno}' => $dbException->getNumber(), '{errmsg}' => $dbException->getText())));
                    }
                }
                $i++;
            }
            if ($profiling) {
                $cmd = $this->db->createCommand('select
						state,
						SUM(duration) as total,
						COUNT(*) AS count
					FROM information_schema.profiling
					GROUP BY state
					ORDER by total desc');
                $cmd->prepare();
                $profileData = $cmd->queryAll();
                if (count($profileData)) {
                    $results = '<table class="profiling">';
                    foreach ($profileData as $item) {
                        $results .= '<tr>';
                        $results .= '<td class="state">' . ucfirst($item['state']) . '</td>';
                        $results .= '<td class="time">' . $item['total'] . '</td>';
                        $results .= '<td class="count">(' . $item['count'] . ')</td>';
                        $results .= '</tr>';
                    }
                    $results .= '</table>';
                    $response->addNotification('info', Yii::t('core', 'profilingResultsSortedByExecutionTime'), $results, null);
                }
            } else {
                if (isset($total) && isset($time)) {
                    $response->addNotification('success', Yii::t('core', 'successExecuteQuery'), Yii::t('core', 'foundRowsQueryTime', array(null, '{rows}' => $total, '{time}' => $time)), $sqlQuery->getQuery());
                }
            }
        }
        // Assign local variables to class properties
        if (isset($pages)) {
            $this->pagination = $pages;
        }
        if (isset($sort)) {
            $this->sort = $sort;
        }
        if (isset($type)) {
            $this->queryType = $type;
        }
        if (isset($columns)) {
            $this->columns = $columns;
            foreach ($this->columns as $column) {
                if ($this->getColumn($column) == null) {
                    $this->singleTableSelect = false;
                    break;
                }
            }
        }
        if (isset($data)) {
            $this->data = $data;
        }
        if (isset($response)) {
            $this->response = $response;
        }
    }
コード例 #15
0
<html>
<head>
    <title>Accounts</title>
    <link href="<?php 
echo css();
?>
bootstrap.min.css" rel="stylesheet">
</head>
<body>
<style>
    table{
        font-size: <?php 
echo $font_size;
?>
;
    }
    table td, th{
        padding: 5px;
    }
    .multiple_entites{
       border-bottom: 1px dashed lightgray;
    }
</style>
<div id="page-wrapper" style="min-height: 700px;">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-12">
                <section class="col-md-12" style="text-align: center;">
                    <h3 class="">
                       Trips Details
                    </h3>
コード例 #16
0
        $n = 0;
        $result = array();
        while ($i < count($left) and $j < count($right)) {
            if ($left[$i] < $right[$j]) {
                $result[$n++] = $left[$i++];
            } else {
                $result[$n++] = $right[$j++];
            }
        }
        while ($i < count($left)) {
            $result[$n++] = $left[$i++];
        }
        while ($j < count($right)) {
            $result[$n++] = $right[$j++];
        }
        $this->array = $result;
        return $result;
    }
    /**
     * 获取排序后的结果
     * @return array
     */
    public function getResult()
    {
        return $this->array;
    }
}
$a = new Sort(array(1, 3, 8, 4, 2, 7, 8, 1));
$a->mergeSort();
print_r($a->getResult());
//print_r($a->mergeSort());
コード例 #17
0
 public function search_trips($keys, $limit, $start, $sort)
 {
     //applying keys....
     include_once APPPATH . "serviceProviders/Sort.php";
     $sorting_info = Sort::columns($keys['module']);
     if ($keys['trip_status'] != '') {
         if ($keys['trip_status'] == 2) {
             $this->db->where('stn_number !=', '');
         }
         if ($keys['trip_status'] == 1) {
             $this->db->where('stn_number', '');
         }
     }
     if ($keys['from'] != '') {
         $this->db->where('entryDate >=', $keys['from']);
     }
     if ($keys['to'] != '') {
         $this->db->where('entryDate <=', $keys['to']);
     }
     if ($keys['trip_id'] != '') {
         $this->db->where('trip_id', $keys['trip_id']);
     }
     if ($keys['entryDate'] != '') {
         $this->db->where('entryDate', $keys['entryDate']);
     }
     if ($keys['product'] != '') {
         $this->db->where_in('product_id', $keys['product']);
     }
     if ($keys['trips_routes'] != '') {
         $where = "(";
         foreach ($keys['trips_routes'] as $route) {
             $route_parts = explode('_', $route);
             $where .= "(source_id = " . $route_parts[0] . " AND destination_id = " . $route_parts[1] . ") OR ";
         }
         $where .= ")";
         $where_parts = explode(') OR )', $where);
         $where = $where_parts[0];
         $where .= "))";
         $this->db->where($where);
     } else {
         if ($keys['source'] != '') {
             $this->db->where_in('source_id', $keys['source']);
         }
         if ($keys['destination'] != '') {
             $this->db->where_in('destination_id', $keys['destination']);
         }
     }
     if ($keys['company'] != '') {
         $this->db->where_in('company_id', $keys['company']);
     }
     if ($keys['contractor'] != '') {
         $this->db->where_in('contractor_id', $keys['contractor']);
     }
     if ($keys['customer'] != '') {
         $this->db->where_in('customer_id', $keys['customer']);
     }
     if ($keys['tanker'] != '') {
         $this->db->where_in('tanker_id', $keys['tanker']);
     }
     if ($keys['stn_number'] != '') {
         $this->db->like('stn_number', $keys['stn_number']);
     }
     if ($keys['trip_type'] != '') {
         $this->db->where_in('trip_type_id', $keys['trip_type']);
     }
     if ($keys['trip_master_type'] != '') {
         if ($keys['trip_master_type'] == 'primary') {
             $where = "(trip_type_id = 2 OR trip_type_id = 4 OR trip_type_id = 1 OR trip_type_id = 5)";
             $this->db->where($where);
         } else {
             if ($keys['trip_master_type'] == 'secondary') {
                 $where = "(trip_type_id = 3)";
                 $this->db->where($where);
             } else {
                 if ($keys['trip_master_type'] == 'secondary_local') {
                     $where = "(trip_type_id = 6)";
                     $this->db->where($where);
                 }
             }
         }
     }
     if ($keys['trip_master_types'] != '') {
         $trip_types = array();
         foreach ($keys['trip_master_types'] as $type) {
             switch ($type) {
                 case "primary":
                     $trip_types = [1, 2, 4, 5];
                     break;
                 case "secondary":
                     array_push($trip_types, 3);
                     break;
                 case "secondary_local":
                     array_push($trip_types, 6);
                     break;
             }
         }
         $this->db->where_in('trip_type_id', $trip_types);
     }
     ///////////////////////////////////////////////////////
     $this->db->select('*');
     $this->db->limit($limit, $start);
     foreach ($sorting_info as $sort) {
         $this->db->order_by($sort['sort_by'], $sort['order_by']);
     }
     $trips = $this->db->get('trips_view')->result();
     return $trips;
 }
コード例 #18
0
if (strpos($this->helper_model->page_url(), '?') == false) {
    echo $this->helper_model->page_url() . "?";
} else {
    echo $this->helper_model->page_url() . "&";
}
?>
print">
<table class="table table-bordered table-hover table-striped accounts-table sortable" style="min-width:1900px;">

<thead style="border-top: 4px solid lightgray;">


<tr>
    <th></th>
    <?php 
echo Sort::createCheckBoxes("manage_accounts_white_oil");
?>
    <th></th>
</tr>
<tr>
    <th colspan="7"></th>
    <th><!--<a href="#" onclick="set_dr_cr_entry_link('shortage_amount_entry_link','shortage_amount')" id="shortage_amount_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a>--></th>
    <th colspan="4"></th>
    <th><a href="#" onclick="set_dr_cr_entry_link('company_total_freight_entry_link','company_total_freight')" id="company_total_freight_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a></th>
    <th><a href="#" onclick="set_dr_cr_entry_link('company_wht_entry_link','company_wht')" id="company_wht_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a></th></th>
    <th><a href="#" onclick="set_dr_cr_entry_link('company_commission_entry_link','company_commission')" id="company_commission_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a></th>
    <th></th>
    <th><a href="#" onclick="set_dr_cr_entry_link('contractor_freight_entry_link','contractor_freight')" id="contractor_freight_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a></th>
    <th><a href="#" onclick="set_dr_cr_entry_link('contractor_freight_without_shortage_entry_link','contractor_freight_without_shortage')" id="contractor_freight_without_shortage_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a></th>
    <th></th>
    <th><a href="#" onclick="set_dr_cr_entry_link('contractor_commission_entry_link','contractor_commission')" id="contractor_commission_entry_link" class="btn btn-danger dr_cr_btn open_voucher_for_user">Dr / Cr</a></th>
コード例 #19
0
 function getSchedule($filter_data, $start_week_day = 0, $group_schedule = FALSE)
 {
     global $current_user, $current_user_prefs;
     //Individual is one schedule per employee, or all on one schedule.
     if (!is_array($filter_data)) {
         return FALSE;
     }
     $current_epoch = time();
     //Debug::Text('Start Date: '. TTDate::getDate('DATE', $start_date) .' End Date: '. TTDate::getDate('DATE', $end_date) , __FILE__, __LINE__, __METHOD__,10);
     Debug::text(' Start Date: ' . TTDate::getDate('DATE+TIME', $filter_data['start_date']) . ' End Date: ' . TTDate::getDate('DATE+TIME', $filter_data['end_date']) . ' Start Week Day: ' . $start_week_day, __FILE__, __LINE__, __METHOD__, 10);
     $pdf = new TTPDF('L', 'pt', 'Letter');
     $left_margin = 20;
     $top_margin = 20;
     $pdf->setMargins($left_margin, $top_margin);
     $pdf->SetAutoPageBreak(TRUE, 30);
     //$pdf->SetAutoPageBreak(FALSE);
     $pdf->SetFont('freesans', '', 10);
     $border = 0;
     $adjust_x = 0;
     $adjust_y = 0;
     if ($group_schedule == FALSE) {
         $valid_schedules = 0;
         $sf = TTnew('ScheduleFactory');
         $tmp_schedule_shifts = $sf->getScheduleArray($filter_data);
         //Re-arrange array by user_id->date
         if (is_array($tmp_schedule_shifts)) {
             foreach ($tmp_schedule_shifts as $day_epoch => $day_schedule_shifts) {
                 foreach ($day_schedule_shifts as $day_schedule_shift) {
                     $raw_schedule_shifts[$day_schedule_shift['user_id']][$day_epoch][] = $day_schedule_shift;
                 }
             }
         }
         unset($tmp_schedule_shifts);
         //Debug::Arr($raw_schedule_shifts, 'Raw Schedule Shifts: ', __FILE__, __LINE__, __METHOD__,10);
         if (isset($raw_schedule_shifts) and is_array($raw_schedule_shifts)) {
             foreach ($raw_schedule_shifts as $user_id => $day_schedule_shifts) {
                 foreach ($day_schedule_shifts as $day_epoch => $day_schedule_shifts) {
                     foreach ($day_schedule_shifts as $day_schedule_shift) {
                         //Debug::Arr($day_schedule_shift, 'aDay Schedule Shift: ', __FILE__, __LINE__, __METHOD__,10);
                         $tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][] = $day_schedule_shift;
                         if (isset($schedule_shift_totals[$day_epoch]['total_shifts'])) {
                             $schedule_shift_totals[$day_epoch]['total_shifts']++;
                         } else {
                             $schedule_shift_totals[$day_epoch]['total_shifts'] = 1;
                         }
                         //$week_of_year = TTDate::getWeek( strtotime($day_epoch) );
                         $week_of_year = TTDate::getWeek(strtotime($day_epoch), $start_week_day);
                         if (!isset($schedule_shift_totals[$day_epoch]['labels'])) {
                             $schedule_shift_totals[$day_epoch]['labels'] = 0;
                         }
                         if ($day_schedule_shift['branch'] != '--' and !isset($schedule_shift_totals[$day_epoch]['branch'][$day_schedule_shift['branch']])) {
                             $schedule_shift_totals[$day_epoch]['branch'][$day_schedule_shift['branch']] = TRUE;
                             $schedule_shift_totals[$day_epoch]['labels']++;
                         }
                         if ($day_schedule_shift['department'] != '--' and !isset($schedule_shift_totals[$day_epoch]['department'][$day_schedule_shift['branch']][$day_schedule_shift['department']])) {
                             $schedule_shift_totals[$day_epoch]['department'][$day_schedule_shift['branch']][$day_schedule_shift['department']] = TRUE;
                             $schedule_shift_totals[$day_epoch]['labels']++;
                         }
                         if (!isset($max_week_data[$week_of_year]['shift'])) {
                             Debug::text('Date: ' . $day_epoch . ' Week: ' . $week_of_year . ' Setting Max Week shift to 0', __FILE__, __LINE__, __METHOD__, 10);
                             $max_week_data[$week_of_year]['shift'] = 1;
                             $max_week_data[$week_of_year]['labels'] = 0;
                         }
                         if (isset($max_week_data[$week_of_year]['shift']) and $schedule_shift_totals[$day_epoch]['total_shifts'] + $schedule_shift_totals[$day_epoch]['labels'] > $max_week_data[$week_of_year]['shift'] + $max_week_data[$week_of_year]['labels']) {
                             Debug::text('Date: ' . $day_epoch . ' Week: ' . $week_of_year . ' Setting Max Week shift to: ' . $schedule_shift_totals[$day_epoch]['total_shifts'] . ' Labels: ' . $schedule_shift_totals[$day_epoch]['labels'], __FILE__, __LINE__, __METHOD__, 10);
                             $max_week_data[$week_of_year]['shift'] = $schedule_shift_totals[$day_epoch]['total_shifts'];
                             $max_week_data[$week_of_year]['labels'] = $schedule_shift_totals[$day_epoch]['labels'];
                         }
                         //Debug::Arr($schedule_shift_totals, ' Schedule Shift Totals: ', __FILE__, __LINE__, __METHOD__,10);
                         //Debug::Arr($max_week_data, ' zMaxWeekData: ', __FILE__, __LINE__, __METHOD__,10);
                     }
                 }
                 if (isset($tmp_schedule_shifts)) {
                     //Sort Branches/Departments first
                     foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
                         ksort($day_tmp_schedule_shift);
                         $tmp_schedule_shifts[$day_epoch] = $day_tmp_schedule_shift;
                         foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
                             ksort($tmp_schedule_shifts[$day_epoch][$branch]);
                         }
                     }
                     //Sort each department by start time.
                     foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
                         foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
                             foreach ($department_schedule_shifts as $department => $department_schedule_shift) {
                                 $department_schedule_shift = Sort::multiSort($department_schedule_shift, 'start_time');
                                 $this->schedule_shifts[$day_epoch][$branch][$department] = $department_schedule_shift;
                             }
                         }
                     }
                 }
                 unset($day_tmp_schedule_shift, $department_schedule_shifts, $department_schedule_shift, $tmp_schedule_shifts, $branch, $department);
                 $calendar_array = TTDate::getCalendarArray($filter_data['start_date'], $filter_data['end_date'], $start_week_day);
                 //var_dump($calendar_array);
                 if (!is_array($calendar_array) or !isset($this->schedule_shifts) or !is_array($this->schedule_shifts)) {
                     continue;
                     //Skip to next user.
                 }
                 $ulf = TTnew('UserListFactory');
                 $ulf->getByIdAndCompanyId($user_id, $current_user->getCompany());
                 if ($ulf->getRecordCount() != 1) {
                     continue;
                 } else {
                     $user_obj = $ulf->getCurrent();
                     $pdf->AddPage();
                     $pdf->setXY(670, $top_margin);
                     $pdf->SetFont('freesans', '', 10);
                     $pdf->Cell(100, 15, TTDate::getDate('DATE+TIME', $current_epoch), $border, 0, 'R');
                     $pdf->setXY($left_margin, $top_margin);
                     $pdf->SetFont('freesans', 'B', 25);
                     $pdf->Cell(0, 25, $user_obj->getFullName() . ' - ' . TTi18n::getText('Schedule'), $border, 0, 'C');
                     $pdf->Ln();
                 }
                 $pdf->SetFont('freesans', 'B', 16);
                 $pdf->Cell(0, 15, TTDate::getDate('DATE', $filter_data['start_date']) . ' - ' . TTDate::getDate('DATE', $filter_data['end_date']), $border, 0, 'C');
                 //$pdf->Ln();
                 $pdf->Ln();
                 $pdf->Ln();
                 $pdf->SetFont('freesans', '', 8);
                 $cell_width = floor(($pdf->GetPageWidth() - $left_margin * 2) / 7);
                 $cell_height = 100;
                 $i = 0;
                 $total_days = count($calendar_array) - 1;
                 $boader = 1;
                 foreach ($calendar_array as $calendar) {
                     if ($i == 0) {
                         //Calendar Header
                         $pdf->SetFont('freesans', 'B', 8);
                         $calendar_header = TTDate::getDayOfWeekArrayByStartWeekDay($start_week_day);
                         foreach ($calendar_header as $header_name) {
                             $pdf->Cell($cell_width, 15, $header_name, 1, 0, 'C');
                         }
                         $pdf->Ln();
                         unset($calendar_header, $header_name);
                     }
                     $month_name = NULL;
                     if ($i == 0 or $calendar['isNewMonth'] == TRUE) {
                         $month_name = $calendar['month_name'];
                     }
                     if ($i > 0 and $i % 7 == 0) {
                         $this->writeWeekSchedule($pdf, $cell_width, $week_date_stamps, $max_week_data, $left_margin, $group_schedule, $start_week_day);
                         unset($week_date_stamps);
                     }
                     $pdf->SetFont('freesans', 'B', 8);
                     $pdf->Cell($cell_width / 2, 15, $month_name, 'LT', 0, 'L');
                     $pdf->Cell($cell_width / 2, 15, $calendar['day_of_month'], 'RT', 0, 'R');
                     $week_date_stamps[] = $calendar['date_stamp'];
                     $i++;
                 }
                 $this->writeWeekSchedule($pdf, $cell_width, $week_date_stamps, $max_week_data, $left_margin, $group_schedule, $start_week_day, TRUE);
                 $valid_schedules++;
                 unset($this->schedule_shifts, $calendar_array, $week_date_stamps, $max_week_data, $day_epoch, $day_schedule_shifts, $day_schedule_shift, $schedule_shift_totals);
             }
         }
         unset($raw_schedule_shifts);
     } else {
         $valid_schedules = 1;
         $sf = TTnew('ScheduleFactory');
         $raw_schedule_shifts = $sf->getScheduleArray($filter_data);
         if (is_array($raw_schedule_shifts)) {
             foreach ($raw_schedule_shifts as $day_epoch => $day_schedule_shifts) {
                 foreach ($day_schedule_shifts as $day_schedule_shift) {
                     //Debug::Arr($day_schedule_shift, 'bDay Schedule Shift: ', __FILE__, __LINE__, __METHOD__,10);
                     $tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][] = $day_schedule_shift;
                     if (isset($schedule_shift_totals[$day_epoch]['total_shifts'])) {
                         $schedule_shift_totals[$day_epoch]['total_shifts']++;
                     } else {
                         $schedule_shift_totals[$day_epoch]['total_shifts'] = 1;
                     }
                     //$week_of_year = TTDate::getWeek( strtotime($day_epoch) );
                     $week_of_year = TTDate::getWeek(strtotime($day_epoch), $start_week_day);
                     Debug::text(' Date: ' . TTDate::getDate('DATE', strtotime($day_epoch)) . ' Week: ' . $week_of_year . ' TMP: ' . TTDate::getWeek(strtotime('20070721'), $start_week_day), __FILE__, __LINE__, __METHOD__, 10);
                     if (!isset($schedule_shift_totals[$day_epoch]['labels'])) {
                         $schedule_shift_totals[$day_epoch]['labels'] = 0;
                     }
                     if ($day_schedule_shift['branch'] != '--' and !isset($schedule_shift_totals[$day_epoch]['branch'][$day_schedule_shift['branch']])) {
                         $schedule_shift_totals[$day_epoch]['branch'][$day_schedule_shift['branch']] = TRUE;
                         $schedule_shift_totals[$day_epoch]['labels']++;
                     }
                     if ($day_schedule_shift['department'] != '--' and !isset($schedule_shift_totals[$day_epoch]['department'][$day_schedule_shift['branch']][$day_schedule_shift['department']])) {
                         $schedule_shift_totals[$day_epoch]['department'][$day_schedule_shift['branch']][$day_schedule_shift['department']] = TRUE;
                         $schedule_shift_totals[$day_epoch]['labels']++;
                     }
                     if (!isset($max_week_data[$week_of_year]['shift'])) {
                         Debug::text('Date: ' . $day_epoch . ' Week: ' . $week_of_year . ' Setting Max Week shift to 0', __FILE__, __LINE__, __METHOD__, 10);
                         $max_week_data[$week_of_year]['shift'] = 1;
                         $max_week_data[$week_of_year]['labels'] = 0;
                     }
                     if (isset($max_week_data[$week_of_year]['shift']) and $schedule_shift_totals[$day_epoch]['total_shifts'] + $schedule_shift_totals[$day_epoch]['labels'] > $max_week_data[$week_of_year]['shift'] + $max_week_data[$week_of_year]['labels']) {
                         Debug::text('Date: ' . $day_epoch . ' Week: ' . $week_of_year . ' Setting Max Week shift to: ' . $schedule_shift_totals[$day_epoch]['total_shifts'] . ' Labels: ' . $schedule_shift_totals[$day_epoch]['labels'], __FILE__, __LINE__, __METHOD__, 10);
                         $max_week_data[$week_of_year]['shift'] = $schedule_shift_totals[$day_epoch]['total_shifts'];
                         $max_week_data[$week_of_year]['labels'] = $schedule_shift_totals[$day_epoch]['labels'];
                     }
                 }
             }
         }
         //print_r($tmp_schedule_shifts);
         //print_r($max_week_data);
         if (isset($tmp_schedule_shifts)) {
             //Sort Branches/Departments first
             foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
                 ksort($day_tmp_schedule_shift);
                 $tmp_schedule_shifts[$day_epoch] = $day_tmp_schedule_shift;
                 foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
                     ksort($tmp_schedule_shifts[$day_epoch][$branch]);
                 }
             }
             //Sort each department by start time.
             foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
                 foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
                     foreach ($department_schedule_shifts as $department => $department_schedule_shift) {
                         $department_schedule_shift = Sort::multiSort($department_schedule_shift, 'last_name');
                         $this->schedule_shifts[$day_epoch][$branch][$department] = $department_schedule_shift;
                     }
                 }
             }
         }
         //Debug::Arr($this->schedule_shifts, 'Schedule Shifts: ', __FILE__, __LINE__, __METHOD__,10);
         $calendar_array = TTDate::getCalendarArray($filter_data['start_date'], $filter_data['end_date'], $start_week_day);
         //var_dump($calendar_array);
         if (!is_array($calendar_array) or !isset($this->schedule_shifts) or !is_array($this->schedule_shifts)) {
             return FALSE;
         }
         $pdf->AddPage();
         $pdf->setXY(670, $top_margin);
         $pdf->SetFont('freesans', '', 10);
         $pdf->Cell(100, 15, TTDate::getDate('DATE+TIME', $current_epoch), $border, 0, 'R');
         $pdf->setXY($left_margin, $top_margin);
         $pdf->SetFont('freesans', 'B', 25);
         $pdf->Cell(0, 25, 'Employee Schedule', $border, 0, 'C');
         $pdf->Ln();
         $pdf->SetFont('freesans', 'B', 10);
         $pdf->Cell(0, 15, TTDate::getDate('DATE', $filter_data['start_date']) . ' - ' . TTDate::getDate('DATE', $filter_data['end_date']), $border, 0, 'C');
         $pdf->Ln();
         $pdf->Ln();
         $pdf->SetFont('freesans', '', 8);
         $cell_width = floor(($pdf->GetPageWidth() - $left_margin * 2) / 7);
         $cell_height = 100;
         $i = 0;
         $total_days = count($calendar_array) - 1;
         $boader = 1;
         foreach ($calendar_array as $calendar) {
             if ($i == 0) {
                 //Calendar Header
                 $pdf->SetFont('freesans', 'B', 8);
                 $calendar_header = TTDate::getDayOfWeekArrayByStartWeekDay($start_week_day);
                 foreach ($calendar_header as $header_name) {
                     $pdf->Cell($cell_width, 15, $header_name, 1, 0, 'C');
                 }
                 $pdf->Ln();
                 unset($calendar_header, $header_name);
             }
             $month_name = NULL;
             if ($i == 0 or $calendar['isNewMonth'] == TRUE) {
                 $month_name = $calendar['month_name'];
             }
             if ($i > 0 and $i % 7 == 0) {
                 $this->writeWeekSchedule($pdf, $cell_width, $week_date_stamps, $max_week_data, $left_margin, $group_schedule, $start_week_day);
                 unset($week_date_stamps);
             }
             $pdf->SetFont('freesans', 'B', 8);
             $pdf->Cell($cell_width / 2, 15, $month_name, 'LT', 0, 'L');
             $pdf->Cell($cell_width / 2, 15, $calendar['day_of_month'], 'RT', 0, 'R');
             $week_date_stamps[] = $calendar['date_stamp'];
             $i++;
         }
         $this->writeWeekSchedule($pdf, $cell_width, $week_date_stamps, $max_week_data, $left_margin, $group_schedule, $start_week_day, TRUE);
     }
     if ($valid_schedules > 0) {
         $output = $pdf->Output('', 'S');
         return $output;
     }
     return FALSE;
 }
コード例 #20
0
        //print_r($schedule_shift_totals);
        if (isset($tmp_schedule_shifts)) {
            //Sort Branches/Departments first
            foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
                ksort($day_tmp_schedule_shift);
                $tmp_schedule_shifts[$day_epoch] = $day_tmp_schedule_shift;
                foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
                    ksort($tmp_schedule_shifts[$day_epoch][$branch]);
                }
            }
            //Sort each department by start time.
            foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
                foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
                    foreach ($department_schedule_shifts as $department => $department_schedule_shift) {
                        //var_dump($department_schedule_shift);
                        $schedule_shifts[$day_epoch][$branch][$department] = Sort::multiSort($department_schedule_shift, 'start_time', 'last_name');
                    }
                }
            }
        }
        //print_r($schedule_shift_totals);
        $calendar_array = TTDate::getCalendarArray($start_date, $end_date, $current_user_prefs->getStartWeekDay(), FALSE);
        $smarty->assign_by_ref('calendar_array', $calendar_array);
        $hlf = TTnew('HolidayListFactory');
        $holiday_array = $hlf->getArrayByPolicyGroupUserId($user_ids, $start_date, $end_date);
        $smarty->assign_by_ref('holidays', $holiday_array);
        $smarty->assign_by_ref('schedule_shifts', $schedule_shifts);
        $smarty->assign_by_ref('schedule_shift_totals', $schedule_shift_totals);
        $smarty->assign_by_ref('do', $do);
        break;
}
コード例 #21
0
ファイル: Sort.php プロジェクト: cebe/chive
    /**
     * Generates a hyperlink that can be clicked to cause sorting.
     * @param string the attribute name. This must be the actual attribute name, not alias.
     * If it is an attribute of a related AR object, the name should be prefixed with
     * the relation name (e.g. 'author.name', where 'author' is the relation name).
     * @param string the link label. If null, the label will be determined according
     * to the attribute (see {@link CActiveRecord::getAttributeLabel}).
     * @param array additional HTML attributes for the hyperlink tag
     * @return string the generated hyperlink
     */
    public function link($attribute, $label = null, $htmlOptions = array())
    {
        $directions = $this->getDirections();
        if (isset($directions[$attribute])) {
            $direction = $directions[$attribute] == 'asc' ? 'desc' : 'asc';
            unset($directions[$attribute]);
        } else {
            $direction = 'asc';
        }
        if ($this->multiSort) {
            $directions = array_merge(array($attribute => $direction), $directions);
        } else {
            $directions = array($attribute => $direction);
        }
        if ($label === null) {
            $label = $attribute;
        }
        $url = $this->createUrl(Yii::app()->getController(), $directions);
        if ($this->postVars) {
            if (self::$generateJs) {
                $data = CJSON::encode($this->postVars);
                $script = '
					function setSort(_field, _direction) {
					
						var data = ' . $data . ';
						data.' . $this->sortVar . ' = _field + "." + _direction; 
						' . (Yii::app()->getRequest()->getParam('page') ? 'data.page = ' . Yii::app()->getRequest()->getParam('page') : '') . '
						' . (Yii::app()->getRequest()->getParam('pageSize') ? 'data.pageSize = ' . Yii::app()->getRequest()->getParam('pageSize') : '') . '
					
						$.post("' . Yii::app()->createUrl($this->route) . '", data, function(responseText) {
							$("div.ui-layout-center").html(responseText);
							init();
						});
					
					}
				';
                Yii::app()->getClientScript()->registerScript('Sort_setSort', $script);
                self::$generateJs = false;
            }
            return CHtml::link($label, 'javascript:void(0)', array('onclick' => 'setSort("' . $attribute . '", "' . $direction . '");'));
        } else {
            return $this->createLink($attribute, $label, $url, $htmlOptions);
        }
    }
コード例 #22
0
ファイル: mleft.php プロジェクト: BassYang1/YueXinChina
    $products = Product::query($query);
    if (empty($products)) {
        $recommendHtml = "<b>暂无产品</b>";
    } else {
        foreach ($products as $product) {
            $recommendHtml .= sprintf("\n\t\t\t\t\t<dl class='l_m_prod'>\n\t\t\t\t\t\t<dd class='f_left'>\n\t\t\t\t\t\t\t<a href='pdetail.php?id=%u' title='%s'>\n\t\t\t\t\t\t\t\t<img src='%s' width='42' height='42' alt='%s' title='%s' class='mm' />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</dd>\n\t\t\t\t\t\t<dt class='f_left' style='width:160px;'>\n\t\t\t\t\t\t\t<div class='nowrap'><a href='pdetail.php?id=%u' title='%s'>%s</a></div>\t\t\n\t\t\t\t\t\t\t<div><a href='%s' target='_blank'><img src='images/buy_s.png' width='70px' height='20px' alt='%s' /></a></div>\t\t\n\t\t\t\t\t\t</dt>\n\t\t\t\t\t</dl>", $product->productId, $product->productName, str_replace("../", "", $product->mImage), $product->productName, $product->productName, $product->productId, $product->productName, $product->productName, $product->aliUrl, $product->productName);
        }
    }
}
?>

<?php 
//产品类型
if ($sections["sort"] === 1) {
    $query = new Sort(25);
    $sorts = Sort::query($query);
    $sortMenu = "";
    if (empty($sorts)) {
        $sortMenu = "<b>暂无分类</b>";
    } else {
        foreach ($sorts as $sort) {
            $sortMenu .= sprintf("<dl><dt style=\"cursor: hand; float: left;\"><span class=\"l_m_item\"><a href=\"product.php?sort=%u\" target=\"_blank\">%s</a></span> </dt></dl>", $sort->sortId, $sort->sortName);
        }
    }
}
$company_name = Company::content("company_name");
$company_qq = Company::content("company_qq");
$official_site = Company::content("official_site");
$ali_wangwang = Company::content("ali_wangwang");
?>
<style>
コード例 #23
0
ファイル: SortAjax.php プロジェクト: nilamdoc/HitarthOM
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/Source/SortDB.php';
// File with DB functions class
if (!$_SESSION) {
    session_start();
}
// Start the session
$Sort = new Sort();
//instantiating class with DB functions
$action = $_REQUEST["action"];
//variable from GET string - shows what action to take
header("Content-type:text/xml");
//setting the content type of the response document to XML
echo '<?xml version="1.0"?><data>';
//setting the root xml tag in the response document
switch ($action) {
    case "FindCabinet":
        $status = $Sort->FindCabinet($_REQUEST['Cabinet']);
        //
        echo '<status><![CDATA[' . $status[0] . ']]></status>';
        //output login status
        echo '<Name><![CDATA[' . $status[1] . ']]></Name>';
        //output login status
        break;
    case "ChangeSort":
        $status = $Sort->SortCabinet($_REQUEST['pkCabinetDetailsID'], $_REQUEST['Sort']);
        //
        echo '<status><![CDATA[' . $status[0] . ']]></status>';
        //output login status
        echo '<Name><![CDATA[' . $status[1] . ']]></Name>';
コード例 #24
0
 public function search_black_oil($keys, $limit, $start)
 {
     //applying keys....
     include_once APPPATH . "serviceProviders/Sort.php";
     $sorting_info = Sort::columns('manage_accounts_black_oil');
     /*
      * -------------------------------
      *  Search By Account Titles
      * -------------------------------
      */
     if ($keys['account_title'] != '') {
         $trip_detail_ids = [];
         if ($keys['dr_cr'] != '') {
             switch ($keys['dr_cr']) {
                 case 1:
                     $this->db->select('ma.trip_detail_id');
                     $this->db->join('dr_cr_status_for_manage_accounts_view as dr_cr_status', 'dr_cr_status.trip_detail_id = ma.trip_detail_id', 'left');
                     $this->db->where('account_title_id', $keys['account_title']);
                     $this->db->where('dr_cr_status.dr_cr', 1);
                     $result = $this->db->get('manage_accounts_white_oil_view as ma')->result();
                     $trip_detail_ids = property_to_array('trip_detail_id', $result);
                     break;
                 case 2:
                     $debit_ids[] = 0;
                     $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id');
                     $this->db->where('account_title_id', $keys['account_title']);
                     $this->db->where('dr_cr_status_for_manage_accounts_view.dr_cr', '1');
                     $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result();
                     $debit_ids = property_to_array('trip_detail_id', $result);
                     $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id');
                     $this->db->where_not_in('dr_cr_status_for_manage_accounts_view.trip_detail_id', $debit_ids);
                     $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result();
                     $trip_detail_ids = property_to_array('trip_detail_id', $result);
                     break;
                 case 0:
                     $this->db->select('ma.trip_detail_id');
                     $this->db->join('dr_cr_status_for_manage_accounts_view as dr_cr_status', 'dr_cr_status.trip_detail_id = ma.trip_detail_id', 'left');
                     $this->db->where('account_title_id', $keys['account_title']);
                     $this->db->where('dr_cr_status.dr_cr', 0);
                     $result = $this->db->get('manage_accounts_white_oil_view as ma')->result();
                     $trip_detail_ids = property_to_array('trip_detail_id', $result);
                     break;
                 case 3:
                     $credit_ids[] = 0;
                     $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id');
                     $this->db->where('account_title_id', $keys['account_title']);
                     $this->db->where('dr_cr_status_for_manage_accounts_view.dr_cr', '0');
                     $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result();
                     $credit_ids = property_to_array('trip_detail_id', $result);
                     $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id');
                     $this->db->where_not_in('dr_cr_status_for_manage_accounts_view.trip_detail_id', $credit_ids);
                     $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result();
                     $trip_detail_ids = property_to_array('trip_detail_id', $result);
                     break;
             }
         }
         if (sizeof($trip_detail_ids) == 0) {
             $trip_detail_ids[] = 0;
         }
     }
     /*-------------------------------*/
     $this->db->select('*');
     /*
      * ------------------------------
      * SEARCH BY TRIPS BILLING
      * ------------------------------
      * */
     if ($keys['bill_status'] != '') {
         if ($keys['bill_status'] == 1) {
             $this->db->where('bill_id !=', 0);
             if ($keys['billed_from'] != '') {
                 $this->db->where('billed_date_time >', $keys['billed_from']);
             }
             if ($keys['billed_to'] != '') {
                 $this->db->where('billed_date_time <', $keys['billed_to']);
             }
         }
         if ($keys['bill_status'] == 0) {
             $this->db->where('bill_id', 0);
         }
     }
     /*--------------------------------------------*/
     /*
      * ------------------------------
      * OPEN AND CLOSED TRIPS
      * -----------------------------
      * */
     if ($keys['trip_status'] != '') {
         if ($keys['trip_status'] == 1) {
             $this->db->where('stn_number', '');
         } else {
             if ($keys['trip_status'] == 2) {
                 $this->db->where('stn_number !=', '');
             }
         }
     }
     /*----------------------------------------*/
     if ($keys['account_title'] != '') {
         if (sizeof($trip_detail_ids) > 0) {
             $this->db->where_in('trip_detail_id', $trip_detail_ids);
         }
     }
     if ($keys['from'] != '') {
         $this->db->where('trip_date >=', $keys['from']);
     }
     if ($keys['to'] != '') {
         $this->db->where('trip_date <=', $keys['to']);
     }
     if ($keys['trip_id'] != '') {
         $this->db->where('trip_id', $keys['trip_id']);
     }
     if ($keys['trip_type'] != '') {
         $this->db->where_in('trip_type_id', $keys['trip_type']);
     }
     if ($keys['trip_master_type'] != '') {
         if ($keys['trip_master_type'] == 'primary') {
             $where = "(trip_type_id = 2 OR trip_type_id = 4)";
             $this->db->where($where);
         } else {
             if ($keys['trip_master_type'] == 'secondary') {
                 $where = "(trip_type_id = 1 OR trip_type_id = 3)";
                 $this->db->where($where);
             } else {
                 if ($keys['trip_master_type'] == 'secondary_local') {
                     $where = "(trip_type_id = 6)";
                     $this->db->where($where);
                 }
             }
         }
     }
     if ($keys['trip_master_types'] != '') {
         $trip_types = array();
         foreach ($keys['trip_master_types'] as $type) {
             switch ($type) {
                 case "primary":
                     $trip_types = [1, 2, 4, 5];
                     break;
                 case "secondary":
                     array_push($trip_types, 3);
                     break;
                 case "secondary_local":
                     array_push($trip_types, 6);
                     break;
             }
         }
         $this->db->where_in('trip_type_id', $trip_types);
     }
     if ($keys['tanker'] != '') {
         $this->db->where_in('tanker_id', $keys['tanker']);
     }
     if ($keys['entryDate'] != '') {
         $this->db->where('trip_date', $keys['entryDate']);
     }
     if ($keys['product'] != '') {
         $this->db->where_in('product_id', $keys['product']);
     }
     if ($keys['trips_routes'] != '') {
         $where = "(";
         foreach ($keys['trips_routes'] as $route) {
             $route_parts = explode('_', $route);
             $where .= "(source_id = " . $route_parts[0] . " AND destination_id = " . $route_parts[1] . ") OR ";
         }
         $where .= ")";
         $where_parts = explode(') OR )', $where);
         $where = $where_parts[0];
         $where .= "))";
         $this->db->where($where);
     } else {
         if ($keys['source'] != '') {
             $this->db->where_in('source_id', $keys['source']);
         }
         if ($keys['destination'] != '') {
             $this->db->where_in('destination_id', $keys['destination']);
         }
     }
     if ($keys['company'] != '') {
         $this->db->where_in('company_id', $keys['company']);
     }
     if ($keys['cmp_freight_unit'] != '') {
         $this->db->where('company_freight_unit', $keys['cmp_freight_unit']);
     }
     if ($keys['cst_freight_unit'] != '') {
         $this->db->where('customer_freight_unit', $keys['cst_freight_unit']);
     }
     if ($keys['wht'] != '') {
         $this->db->where('wht', $keys['wht']);
     }
     if ($keys['company_commission'] != '') {
         $this->db->where('company_commission', $keys['company_commission']);
     }
     if ($keys['contractor'] != '') {
         $this->db->where_in('contractor_id', $keys['contractor']);
     }
     if ($keys['contractor_commission'] != '') {
         $this->db->where('contractor_commission', $keys['contractor_commission']);
     }
     if ($keys['customer'] != '') {
         $this->db->where_in('customer_id', $keys['customer']);
     }
     if ($keys['cst_freight_unit'] != '') {
         $this->db->where('customer_freight_unit', $keys['cst_freight_unit']);
     }
     /*
      * --------------------------------------
      * filter by trip details ids
      * --------------------------------------
      * */
     if (isset($keys['trip_detail_ids']) && $keys['trip_detail_ids'] != '') {
         $this->db->where_in('trip_detail_id', $keys['trip_detail_ids']);
     }
     foreach ($sorting_info as $sort) {
         $this->db->order_by($sort['sort_by'], $sort['order_by']);
     }
     $this->db->limit($limit, $start);
     $accounts = $this->db->get('manage_accounts_black_oil_view')->result();
     return $accounts;
 }
コード例 #25
0
     }
     //Sort each department by start time.
     //Remember that we have to handle split shifts here, so its more difficult to sort by last name.
     foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
         foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
             foreach ($department_schedule_shifts as $department => $department_schedule_shift) {
                 $tmp2_schedule_shifts[$day_epoch][$branch][$department] = Sort::multiSort($department_schedule_shift, 'start_time');
             }
         }
     }
     //Sort each department by start time.
     foreach ($tmp2_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
         foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
             foreach ($department_schedule_shifts as $department => $user_schedule_shifts) {
                 foreach ($user_schedule_shifts as $user => $user_schedule_shift) {
                     $schedule_shifts[$day_epoch][$branch][$department][$user] = Sort::multiSort($user_schedule_shift, 'start_time');
                 }
             }
         }
     }
     unset($tmp_schedule_shifts, $tmp2_schedule_shifts);
     $tmp_schedule_shifts = $schedule_shifts;
 }
 //print_r($schedule_shifts);
 if (isset($tmp_schedule_shifts)) {
     //Format array so Smarty has an easier time.
     foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
         foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
             foreach ($department_schedule_shifts as $department => $user_schedule_shifts) {
                 foreach ($user_schedule_shifts as $user_id => $user_schedule_shifts) {
                     $x = 0;
コード例 #26
0
 $column_widths = array('line' => 5, 'date_stamp' => 20, 'dow' => 10, 'in_punch_time_stamp' => 20, 'out_punch_time_stamp' => 20, 'worked_time' => 15, 'paid_time' => 15, 'regular_time' => 15, 'over_time' => 37, 'absence_time' => 43);
 if (isset($user_data['data']) and is_array($user_data['data'])) {
     if (isset($filter_data['date_type']) and $filter_data['date_type'] == 'pay_period_ids') {
         //Fill in any missing days, only if they select by pay period.
         $pplf = new PayPeriodListFactory();
         $pplf->getById($user_data['pay_period_id']);
         if ($pplf->getRecordCount() == 1) {
             $pp_obj = $pplf->getCurrent();
             for ($d = TTDate::getBeginDayEpoch($pp_obj->getStartDate()); $d <= $pp_obj->getEndDate(); $d += 86400) {
                 if (Misc::inArrayByKeyAndValue($user_data['data'], 'date_stamp', TTDate::getBeginDayEpoch($d)) == FALSE) {
                     $user_data['data'][] = array('date_stamp' => TTDate::getBeginDayEpoch($d), 'in_punch_time' => NULL, 'out_punch_time' => NULL, 'worked_time' => NULL, 'regular_time' => NULL, 'over_time' => NULL, 'paid_time' => NULL, 'absence_time' => NULL);
                 }
             }
         }
     }
     $user_data['data'] = Sort::Multisort($user_data['data'], 'date_stamp', NULL, 'ASC');
     $week_totals = Misc::preSetArrayValues(NULL, array('worked_time', 'paid_time', 'absence_time', 'regular_time', 'over_time'), 0);
     $totals = array();
     $totals = Misc::preSetArrayValues($totals, array('worked_time', 'paid_time', 'absence_time', 'regular_time', 'over_time'), 0);
     $i = 1;
     $x = 1;
     $y = 1;
     $max_i = count($user_data['data']);
     foreach ($user_data['data'] as $data) {
         //print_r($data);
         //Show Header
         if ($i == 1 or $x == 1) {
             if ($x == 1) {
                 $pdf->Ln();
             }
             $line_h = 5;
コード例 #27
0
ファイル: FileSort.php プロジェクト: solleer/framework
 public function __construct(\Maphper\Maphper $maphper, $filePath, $sort = null)
 {
     $this->filePath = $filePath;
     parent::__construct($maphper, $sort);
 }
コード例 #28
0
            <thead style="border-top: 3px solid lightgray;">

            <tr>
                <?php 
echo Sort::createPrintableHeaders("manage_accounts_black_oil", $columns);
?>
            </tr>

            </thead>

            <tbody>

            <?php 
$selected_columns = $columns;
$columns = Sort::columns('manage_accounts_black_oil');
//Showing Customers Data
foreach ($accounts as $record) {
    echo "<tr>";
    $markup = "";
    $markup .= printable_column('trip_id', $selected_columns, $record->trip_id);
    $markup .= printable_column('trip_sub_type', $selected_columns, $record->trip_sub_type);
    $markup .= printable_column('trip_date', $selected_columns, $record->trip_date);
    $markup .= printable_column('source', $selected_columns, $record->source);
    $markup .= printable_column('destination', $selected_columns, $record->destination);
    $markup .= printable_column('invoice_date', $selected_columns, $record->invoice_date);
    $markup .= printable_column('invoice_number', $selected_columns, $record->invoice_number);
    $markup .= printable_column('stn_number', $selected_columns, $record->stn_number);
    $markup .= printable_column('tanker_number', $selected_columns, $record->tanker_number);
    $markup .= printable_column('product', $selected_columns, $record->product);
    $markup .= printable_column('dis_qty', $selected_columns, $record->dis_qty / $unit);
コード例 #29
0
     }
     $rows = Misc::ArrayGroupBy($rows, array(Misc::trimSortPrefix($filter_data['primary_group_by']), Misc::trimSortPrefix($filter_data['secondary_group_by'])), Misc::trimSortPrefix($ignore_elements));
 }
 if (isset($rows)) {
     foreach ($rows as $row) {
         $tmp_rows[] = $row;
     }
     //var_dump($tmp_rows);
     $special_sort_columns = array('pay_period');
     if (in_array(Misc::trimSortPrefix($filter_data['primary_sort']), $special_sort_columns)) {
         $filter_data['primary_sort'] = $filter_data['primary_sort'] . '_order';
     }
     if (in_array(Misc::trimSortPrefix($filter_data['secondary_sort']), $special_sort_columns)) {
         $filter_data['secondary_sort'] = $filter_data['secondary_sort'] . '_order';
     }
     $rows = Sort::Multisort($tmp_rows, Misc::trimSortPrefix($filter_data['primary_sort']), Misc::trimSortPrefix($filter_data['secondary_sort']), $filter_data['primary_sort_dir'], $filter_data['secondary_sort_dir']);
     $total_row = Misc::ArrayAssocSum($rows, NULL, 2);
     $last_row = count($rows);
     $rows[$last_row] = $total_row;
     foreach ($static_columns as $static_column_key => $static_column_val) {
         $rows[$last_row][Misc::trimSortPrefix($static_column_key)] = NULL;
     }
     unset($static_column_key, $static_column_val);
     //Convert units
     $tmp_rows = $rows;
     unset($rows);
     $trimmed_static_columns = array_keys(Misc::trimSortPrefix($static_columns));
     foreach ($tmp_rows as $row) {
         foreach ($row as $column => $column_data) {
             if (!strstr($column, 'wage') and !strstr($column, 'worked_days') and !in_array($column, $trimmed_static_columns)) {
                 $column_data = TTDate::getTimeUnit($column_data);
コード例 #30
0
ファイル: exam.php プロジェクト: hemsinfotech/kodelearn
 private function get_list()
 {
     if ($this->request->param('sort')) {
         $sort = $this->request->param('sort');
     } else {
         $sort = 'name';
     }
     if ($this->request->param('order')) {
         $order = $this->request->param('order');
     } else {
         $order = 'DESC';
     }
     if ($this->request->param('filter_grading_period')) {
         $filters = array('filter_grading_period' => $this->request->param('filter_grading_period'));
         $total = Model_Exam::exams_total_grading_period($filters);
         $count = $total;
         $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
         $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
         $exams = Model_Exam::exams_grading_period($filters);
     } else {
         if ($this->request->param('filter_date')) {
             $sdate = strtotime($this->request->param('filter_date'));
             $edate = $sdate + 86400;
             $filters = array('sdate' => $sdate, 'edate' => $edate);
             $total = Model_Exam::exams_total_date($filters);
             $count = $total;
             $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
             $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
             $exams = Model_Exam::exams_date($filters);
         } else {
             if ($this->request->param('filter_course')) {
                 $filters = array('filter_course' => $this->request->param('filter_course'));
                 $total = Model_Exam::exams_total_course($filters);
                 $count = $total;
                 $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
                 $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
                 $exams = Model_Exam::exams_course($filters);
             } else {
                 $filters = array('filter_name' => $this->request->param('filter_name'), 'filter_passing_marks' => $this->request->param('filter_passing_marks'), 'filter_total_marks' => $this->request->param('filter_total_marks'), 'filter_reminder' => $this->request->param('filter_reminder'));
                 $total = Model_Exam::exams_total($filters);
                 $count = $total;
                 $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5));
                 $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset));
                 $exams = Model_Exam::exams($filters);
             }
         }
     }
     $sorting = new Sort(array('Name' => 'name', 'Grading Period' => '', 'Date / Time' => 'events.eventstart', 'Course' => '', 'Total Marks' => 'total_marks', 'Passing Marks' => 'passing_marks', 'Reminder' => 'reminder', 'Action' => ''));
     $url = 'exam/index';
     if ($this->request->param('filter_name')) {
         $url .= '/filter_name/' . $this->request->param('filter_name');
         $filter = $this->request->param('filter_name');
         $filter_select = 'filter_name';
     }
     if ($this->request->param('filter_passing_marks')) {
         $url .= '/filter_passing_marks/' . $this->request->param('filter_passing_marks');
         $filter = $this->request->param('filter_passing_marks');
         $filter_select = 'filter_passing_marks';
     }
     if ($this->request->param('filter_total_marks')) {
         $url .= '/filter_total_marks/' . $this->request->param('filter_total_marks');
         $filter = $this->request->param('filter_total_marks');
         $filter_select = 'filter_total_marks';
     }
     if ($this->request->param('filter_grading_period')) {
         $url .= '/filter_grading_period/' . $this->request->param('filter_grading_period');
         $filter = $this->request->param('filter_grading_period');
         $filter_select = 'filter_grading_period';
     }
     if ($this->request->param('filter_date')) {
         $url .= '/filter_date/' . $this->request->param('filter_date');
         $filter = $this->request->param('filter_date');
         $filter_select = 'filter_date';
     }
     if ($this->request->param('filter_course')) {
         $url .= '/filter_course/' . $this->request->param('filter_course');
         $filter = $this->request->param('filter_course');
         $filter_select = 'filter_course';
     }
     if ($this->request->param('filter_reminder')) {
         $url .= '/filter_reminder/' . $this->request->param('filter_reminder');
         $filter = $this->request->param('filter_reminder');
         $filter_select = 'filter_reminder';
     }
     $sorting->set_link($url);
     $sorting->set_order($order);
     $sorting->set_sort($sort);
     $heading = $sorting->render();
     $table = array('heading' => $heading, 'data' => $exams);
     // Render the pagination links
     $pagination = $pagination->render();
     $links = array('add' => Html::anchor('/exam/add/', 'Create an Exam', array('class' => 'createButton l')), 'delete' => URL::site('/exam/delete/'), 'examgroup' => Html::anchor('examgroup', 'Grading Period', array('class' => 'l pageAction')), 'examresult' => Html::anchor('examresult/upload', 'Manage Results', array('class' => '1 pageAction')));
     $filter_name = $this->request->param('filter_name');
     $filter_passing_marks = $this->request->param('filter_passing_marks');
     $filter_total_marks = $this->request->param('filter_total_marks');
     $filter_url = URL::site('exam/index');
     $success = Session::instance()->get('success');
     Session::instance()->delete('success');
     $view = View::factory('exam/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success)->bind('pagination', $pagination);
     Breadcrumbs::add(array('Exams', Url::site('exam')));
     $this->content = $view;
 }