public function fullAction($reception = null) { $this->view->setVar("TopMenuSelected", 'work'); $this->view->setVar("MenuSelected", 'search'); $this->view->setVar("MenuItemActive", $reception); if (!empty($reception)) { switch ($reception) { case 'package': $this->view->setVar("StationsAll", Stations::getStations()); $this->view->setVar("PackageStatusAll", References::getPackageStatus()); $this->view->setVar("CountriesAll", References::getCountries()); $this->view->setVar("result_search", Package::getAll()); if ($this->request->get('submit')) { $this->view->setVar("result_search", Package::findPackages($this->request->get(), Users::getStationId($this))); $this->view->setVar("post", $this->request->get()); $view = 'form_' . $reception; } else { $view = 'form_' . $reception; } View::addJs($this, ['/js/async/jquery.mb.browser.js', '/js/async/jquery.mousewheel.js', '/js/async/calendar_date-time.js']); View::addCss($this, ['/css/calendar_date-time.css']); break; } } $this->view->pick('/search/' . $view); }
public function addAction($reception = null) { $this->view->setVar("TopMenuSelected", 'work'); $this->view->setVar("MenuSelected", 'add'); $this->view->setVar("MenuItemActive", $reception); if (!empty($reception)) { $this->view->setVar("countries", References::getCountries()); $this->view->setVar("currency", References::getCurrency()); $this->view->setVar("units_1", References::getUnits(NULL, array(1))['units']); $this->view->setVar("units_34", References::getUnits(NULL, array(3, 4))['units']); $this->view->setVar("date_on_reception_default", date('d-m-Y H:i:s')); $this->view->pick('/package/' . $reception); View::addJs($this, ['/js/async/jquery.tmpl.min.js', '/js/async/scripts_package_add.js', '/js/async/jquery.mb.browser.js', '/js/async/jquery.mousewheel.js', '/js/async/calendar_date-time.js']); View::addCss($this, ['/css/calendar_date-time.css']); } if ($this->request->isPost()) { $post = $this->request->getPost(); $user_id = Users::getId($this); $station_id = Users::getStationId($this); $package_document = $post['cont_type']; if ($package_document == '0') { $pcp = $post['pack_cont_pl']; $package_contents_places = array(); for ($i = 0; $i < count($pcp); $i++) { $pcpa = $pcp[$i]['att']; $package_contents_place_attachments = array(); for ($j = 0; $j < count($pcpa); $j++) { $package_contents_place_attachments[] = array('description' => $pcpa[$j]['descr'], 'unit_count' => $pcpa[$j]['u_count'], 'units_id' => $pcpa[$j]['units'], 'unit_price' => $pcpa[$j]['price']); } $package_contents_places[] = array('length' => $pcp[$i]['length'], 'width' => $pcp[$i]['width'], 'height' => $pcp[$i]['height'], 'units_id' => $post['pack_cont_pl_units'], 'attachment' => $package_contents_place_attachments); } $time_arr = explode(' ', $post['date_on_reception']); $date_arr = explode('-', $time_arr[0]); $date_on_reception = $date_arr[2] . '-' . $date_arr[1] . '-' . $date_arr[0] . ' ' . $time_arr[1]; for ($i = 0; $i < count($post['package_rec_name']); $i++) { for ($j = 0; $j < count($post['package_send_name']); $j++) { $package_id = Package::addNotDocument($post['package_send_name'][$i], $post['package_send_addr'][$i], $post['package_send_country'][$i], $post['package_rec_name'][$j], $post['package_rec_addr'][$j], $post['package_rec_country'][$j], $station_id, $post['pack_cont_descr_nd'], $post['pack_cont_pl_count_nd'], $post['pack_cont_weight_nd'], $post['pack_cont_curr_nd'], $package_contents_places, $post['pack_cont_comm_nd'], 'null', 'null', $post['package_send_phone'][$i], $post['package_rec_phone'][$j], $post['package_guar'], $date_on_reception); /**/ $res = Package::setStatus($package_id[0]['package_add_all_not_document'], 2, 'true', $user_id, 'null'); /**/ } } } else { for ($i = 0; $i < count($post['package_rec_name']); $i++) { for ($j = 0; $j < count($post['package_send_name']); $j++) { $package_id = Package::addDocument($post['package_send_name'][$i], $post['package_send_addr'][$i], $post['package_send_country'][$i], $post['package_rec_name'][$j], $post['package_rec_addr'][$j], $post['package_rec_country'][$j], $station_id, $post['pack_cont_descr_d'], $post['pack_cont_pl_count_d'], $post['pack_cont_weight_d'], 'null', $post['pack_cont_comm_d'], 'null', 'null', $post['package_send_phone'][$i], $post['package_rec_phone'][$j], $post['package_guar'], $date_on_reception); /**/ $res = Package::setStatus($package_id[0]['package_add_all_document'], 2, 'true', $user_id, 'null'); /**/ } } } //$this->response->redirect('/search/full/package', '/'); //$this->view->setVar("test", $package_id); } }
/** * A function to generate event block in day calendar * @param object $event event to format * @param string $color event color * @return html formatted item */ public static function day_calendar_item($event, $class) { global $urlServer, $is_admin, $langVisible, $dateFormatLong, $langDuration, $langAgendaNoTitle, $langModify, $langDelete, $langHour, $langConfirmDelete, $langReferencedObject; $formatted_calendar_item = ""; $formatted_calendar_item .= "<tr {$class}>"; $formatted_calendar_item .= "<td valign='top'><div class=\"legend_color\" style=\"float:left;margin:3px;height:16px;width:16px;background-color:" . Calendar_Events::$calsettings->{$event->event_group . "_color"} . "\"></div></td>"; $formatted_calendar_item .= "<td valign='top'>"; $eventdate = strtotime($event->start); $formatted_calendar_item .= $langHour . ": " . ucfirst(date('H:i', $eventdate)); if ($event->duration != '') { $msg = "({$langDuration}: " . q($event->duration) . ")"; } else { $msg = ''; } $formatted_calendar_item .= "<br><b><div class='event'>"; $link = str_replace('thisid', $event->id, $urlServer . Calendar_Events::$event_type_url[$event->event_type]); if ($event->event_type != 'personal' && $event->event_type != 'admin') { $link = str_replace('thiscourse', $event->course, $link); } if ($event->title == '') { $formatted_calendar_item .= $langAgendaNoTitle; } else { if (!$is_admin && $event->event_type == 'admin') { $formatted_calendar_item .= q($event->title); } else { $formatted_calendar_item .= "<a href=\"" . $link . "\">" . q($event->title) . "</a>"; } } if ($event->event_type == "personal") { $fullevent = Calendar_Events::get_event($event->id); if ($reflink = References::item_link($fullevent->reference_obj_module, $fullevent->reference_obj_type, $fullevent->reference_obj_id, $fullevent->reference_obj_course)) { $formatted_calendar_item .= "</b> {$msg} " . standard_text_escape($event->content) . "{$langReferencedObject}: " . $reflink . "</div></td>"; } } else { $formatted_calendar_item .= "</b> {$msg} " . standard_text_escape($event->content) . "</div></td>"; } $formatted_calendar_item .= "<td class='right' width='70'>"; if ($event->event_type == "personal" || $event->event_type == "admin" && $is_admin) { $formatted_calendar_item .= icon('fa-edit', $langModify, str_replace('thisid', $event->id, Calendar_Events::$event_type_url[$event->event_type])) . " \r\n " . icon('fa-times', $langDelete, "?delete={$event->id}&et={$event->event_type}", "onClick=\"return confirmation('{$langConfirmDelete}');\"") . " "; } $formatted_calendar_item .= "</td>"; $formatted_calendar_item .= "</tr>"; return $formatted_calendar_item; }
<label for='enddate' class='col-sm-2 control-label'>$langUntil:</label> <div class='col-sm-4'> <div class='input-group'> <input class='form-control' type='text' name='enddate' id='enddate' value='$enddate' type='text' > <div class='input-group-addon'><span class='add-on'><i class='fa fa-calendar fa-fw'></i></span></i></div> </div> </div> </div> </div>"; if (!isset($_GET['addAdminEvent']) && !isset($_GET['admin'])) { $eventtype = 'personal'; $tool_content .= " <div class='form-group'> <label for='startdate' class='col-sm-2 control-label'>$langReferencedObject:</label> <div class='col-sm-10'> " . References::build_object_referennce_fields($gen_type_selected, $course_selected, $type_selected, $object_selected) . " </div> </div>"; } else { $eventtype = 'admin'; $selectedvis = array(0 => "", USER_TEACHER => "", USER_STUDENT => "", USER_GUEST => ""); if (isset($visibility_level)) { $selectedvis[$visibility_level] = "selected"; } $tool_content .= " <div class='form-group'> <label for='startdate' class='col-sm-2 control-label'>$langShowTo:</label> <div class='col-sm-10'> <select class='form-control' name='visibility_level'> <option value=\"" . USER_STUDENT . "\" " . $selectedvis[USER_STUDENT] . ">$langShowToAllregistered</option> <option value=\"" . USER_GUEST . "\" " . $selectedvis[USER_GUEST] . ">$langShowToAll</option>
public function personAction($reception = null, $item_id = null) { $this->view->setVar("TopMenuSelected", 'work'); $this->view->setVar("MenuSelected", 'persons'); $this->view->setVar("MenuItemActive", $reception); $messages = array(); if (!empty($reception)) { $view = $reception; switch ($reception) { case 'add': $this->view->setVar("CountriesAll", References::getCountries()); break; case 'preview-cache-station': if ($this->request->isPost()) { if ((bool) $this->request->getPost('add')) { View::addMessages($this, [References::addPersonNew($this->request->getPost('full_name'), $this->request->getPost('address'), $this->request->getPost('country_id'), 3, $this->request->getPost('code'), 1, $this->request->getPost('phone'), Users::getStationId($this))]); } } View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень записей Адресной книги кэшированных только для этой станции.</p>")]); $this->view->setVar("PersonsCacheAll", References::getPersonsCache(Users::getStationId($this))); break; case 'preview-cache': if ($this->request->isPost()) { } View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень часто использующихся записей Адресной книги всех станций.</p>")]); $this->view->setVar("PersonsCacheAll", References::getPersonsHot()); break; case 'preview': if ($this->request->isPost()) { //$messages[] = Users::addUser($this->request->getPost()); //$messages[] = Users::deleteUser($this->request->getPost('id')); } View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Полный перечень записей Адресной книги всех станций.</p>")]); $this->view->setVar("PersonsCacheAll", References::getPersonsAll()); break; case 'edit': if (empty($item_id)) { if ($this->request->isPost()) { $this->response->redirect('/administration/user/edit/' . $this->request->getPost('user_id'), '/'); } $messages[] = array('class' => 'alert-info', 'text' => "<p><b>Выберите</b> из выпадающего списка <b>профиль пользователя</b>, который нужно изменить.</p>"); $this->view->setVar("UsersAll", Users::getUsers()); } else { if ($this->request->isPost()) { $messages[] = Users::setUser($this->request->getPost()); } $this->view->setVar("User", Users::getUsers($item_id)); $this->view->setVar("StationsAll", Stations::getStations()); $this->view->setVar("RolesAll", Roles::getRoles()); $this->view->setVar("LanguagesAll", References::getLanguages()); $this->view->setVar("CurrencyAll", References::getCurrency()); $this->view->setVar("Units1", References::getUnits(NULL, array(1))['units']); $this->view->setVar("Units2", References::getUnits(NULL, array(3))['units']); $this->view->setVar("Units3", References::getUnits(NULL, array(4))['units']); } break; case 'settings': if ($this->request->isPost()) { $messages[] = Users::addUser($this->request->getPost()); //$messages[] = Users::deleteUser($this->request->getPost('id')); } $this->view->setVar("UsersAll", Users::getUsers()); break; } $this->view->pick('/administration/' . "person_" . $view); } //$this->view->setVar("messages", $messages); }
public static function deleteStationsStatus($id) { $references = new References(); $links = References::getStationsStatus($id); if (count($links) > 0) { if ($links[0]['from_stations_list'] > 0) { return array('class' => 'alert-warning', 'text' => "<p>Запись <b> " . $links[0]['name'] . " не</b> может быть <b>удалена</b>, так как связана с одной или несколькими записями. Необходимо <b>переопределить</b> или <b>удалить</b> эти связи, после чего повторите попытку.</p>"); } else { $query = "DELETE FROM stations_status_list WHERE id = {$id}"; $res = new Phalcon\Mvc\Model\Resultset\Simple(null, $references, $references->getReadConnection()->query($query)); return array('class' => 'alert-success', 'text' => "<p>Удаление записи <b>" . $links[0]['name'] . "</b> произошло успешно.</p>"); } } return array('class' => 'alert-danger', 'text' => "<p>Запись не найдена.</p>"); }
/** * Update existing note and logs the action * @param int $noteid id in table note * @param string $title note title * @param text $content note body * @param string $reference_obj_id refernced object by note. It contains the object type (from $ref_object_types) and object id (id in the corresponding db table), e.g., video_link:5 */ public static function update_note($noteid, $title, $content, $reference_obj_id = NULL){ global $uid; $refobjinfo = References::get_ref_obj_field_values($reference_obj_id); Database::get()->query("UPDATE note SET title = ?s, content = ?s, reference_obj_module = ?d, reference_obj_type = ?s, reference_obj_id = ?d, reference_obj_course = ?d WHERE id = ?d", $title, purify($content), $refobjinfo['objmodule'], $refobjinfo['objtype'], $refobjinfo['objid'], $refobjinfo['objcourse'], $noteid); Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_NOTE, $noteid); Log::record(0, MODULE_ID_NOTES, LOG_MODIFY, array('user_id' => $uid, 'id' => $noteid, 'title' => $title, 'content' => ellipsize_html(canonicalize_whitespace(strip_tags($content)), 50, '+'))); }
$tool_content .= "<th class='text-center'>".icon('fa-gears')."</th>"; $tool_content .= "</tr>"; } foreach ($notelist as $note) { $content = standard_text_escape($note->content); $note->date_time = claro_format_locale_date($dateFormatLong, strtotime($note->date_time)); $tool_content .= "<tr><td><b>"; if (empty($note->title)) { $tool_content .= $langNoteNoTitle; } else { $tool_content .= "<a href='$_SERVER[SCRIPT_NAME]?nid=" . getIndirectReference($note->id)."'>" . q($note->title) . "</a>"; } $tool_content .= "</b><br><small>" . nice_format($note->date_time) . "</small>"; if (!is_null($note->reference_obj_type)) { $tool_content .= "<br><small>$langReferencedObject: " . References::item_link($note->reference_obj_module, $note->reference_obj_type, $note->reference_obj_id, $note->reference_obj_course) . "</small>"; } $tool_content .= standard_text_escape(ellipsize_html($content, 500, "<strong> ...<a href='$_SERVER[SCRIPT_NAME]?nid=" . getIndirectReference($note->id)."'> <span class='smaller'>[$langMore]</span></a></strong>")); $tool_content .= "</td>"; $tool_content .= "<td class='option-btn-cell'>" . action_button(array( array('title' => $langEditChange, 'url' => "$_SERVER[SCRIPT_NAME]?modify=" . getIndirectReference($note->id), 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "$_SERVER[SCRIPT_NAME]?delete=" . getIndirectReference($note->id), 'confirm' => $langSureToDelNote, 'class' => 'delete', 'icon' => 'fa-times'),
$type_selected = null; } if (!isset($object_selected)) { $object_selected = null; } $tool_content .= "\r\n <div class='form-wrapper'>\r\n <form class='form-horizontal' role='form' method='post' action='{$_SERVER['SCRIPT_NAME']}' onsubmit=\"return checkrequired(this, 'antitle');\" style='display:inline'>\r\n <input type='hidden' name='id' value='{$eventToModify}'>\r\n <div class='form-group'>\r\n <label for='newTitle' class='col-sm-2 control-label'>{$langEventTitle}:</label>\r\n <div class='col-sm-10'>\r\n <input class='form-control' type='text' name='newTitle' id='newTitle' value='{$titleToModify}' placeholder='{$langEventTitle}'>\r\n </div>\r\n </div>\r\n <div class='form-group'>\r\n <label for='newContent' class='col-sm-2 control-label'>{$langEventBody}:</label>\r\n <div class='col-sm-10'>\r\n " . rich_text_editor('newContent', 4, 20, $contentToModify) . "\r\n </div>\r\n </div>\r\n <div class='form-group'>\r\n <label for='startdate' class='col-sm-2 control-label'>{$langDate}:</label>\r\n <div class='col-sm-10'>\r\n <input class='form-control' type='text' name='startdate' id='startdate' value='{$datetimeToModify}'>\r\n </div>\r\n </div>\r\n <div class='form-group'>\r\n <label for='duration' class='col-sm-2 control-label'>{$langDuration}:</label>\r\n <div class='col-sm-10'>\r\n <input class='form-control' type='text' name='duration' id='duration' value='{$durationToModify}'>\r\n </div>\r\n </div>"; if (!isset($_GET['modify'])) { $tool_content .= "\r\n <div class='form-group'>\r\n <label for='frequencynumber' class='col-sm-2 control-label'>{$langRepeat} {$langEvery}:</label>\r\n <div class='col-sm-2'>\r\n <select class='form-control' name='frequencynumber' id='frequencynumber'>\r\n <option value='0'>{$langSelectFromMenu}</option>"; for ($i = 1; $i < 10; $i++) { $tool_content .= "<option value=\"{$i}\">{$i}</option>"; } $tool_content .= "</select>\r\n </div>\r\n <div class='col-sm-2'>\r\n <select class='form-control' name='frequencyperiod'>\r\n <option value=''>{$langSelectFromMenu}...</option>\r\n <option value='D'>{$langDays}</option>\r\n <option value='W'>{$langWeeks}</option>\r\n <option value='M'>{$langMonthsAbstract}</option>\r\n </select>\r\n </div>\r\n <label for='enddate' class='col-sm-2 control-label'>{$langUntil}:</label>\r\n <div class='col-sm-2'>\r\n <input class='form-control' type='text' name='enddate' id='enddate' value=''>\r\n </div> \r\n </div>"; } if (!isset($_GET['addAdminEvent']) && !isset($_GET['admin'])) { $eventtype = 'personal'; $tool_content .= "\r\n <div class='form-group'>\r\n <label for='startdate' class='col-sm-2 control-label'>{$langReferencedObject}:</label>\r\n <div class='col-sm-10'>\r\n " . References::build_object_referennce_fields($gen_type_selected, $course_selected, $type_selected, $object_selected) . "\r\n </div>\r\n </div>"; } else { $eventtype = 'admin'; $selectedvis = array(0 => "", USER_TEACHER => "", USER_STUDENT => "", USER_GUEST => ""); if (isset($visibility_level)) { $selectedvis[$visibility_level] = "selected"; } $tool_content .= "\r\n <div class='form-group'>\r\n <label for='startdate' class='col-sm-2 control-label'>{$langShowTo}:</label>\r\n <div class='col-sm-10'>\r\n <select class='form-control' name='visibility_level'>\r\n <option value='0' {$selectedvis['0']}>{$langShowToAdminsOnly}</option>\r\n <option value=\"" . USER_TEACHER . "\" " . $selectedvis[USER_TEACHER] . ">{$langShowToAdminsandProfs}</option>\r\n <option value=\"" . USER_STUDENT . "\" " . $selectedvis[USER_STUDENT] . ">{$langShowToAllregistered}</option>\r\n <option value=\"" . USER_GUEST . "\" " . $selectedvis[USER_GUEST] . ">{$langShowToAll}</option>\r\n </select>\r\n </div>\r\n </div>"; } $tool_content .= "\r\n <div class='form-group'>\r\n <div class='col-sm-10 col-sm-offset-2'>\r\n <input class='btn btn-primary' type='submit' name='submitEvent' value='{$langAdd}'>\r\n <a class='btn btn-default' href='index.php'>{$langCancel}</a>\r\n </div>\r\n </div> \r\n </form>\r\n</div>\r\n <form method='POST' action='{$_SERVER['SCRIPT_NAME']}?delete={$eventToModify}&et={$eventtype}' accept-charset='UTF-8' style='display:inline'>\r\n <a class='btn btn-danger' data-toggle='modal' data-target='#confirmAction' data-title='{$langConfirmDelete}' data-message='{$langDelEventConfirm}' data-cancel-txt='{$langCancel}' data-action-txt='{$langDelete}' data-action-class='btn-danger'>{$langDelete}</a>\r\n </form> \r\n "; } else { /* display actions toolbar */ $tool_content .= action_bar(array(array('title' => $langAddEvent, 'url' => "{$_SERVER['SCRIPT_NAME']}?addEvent=1", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langAddAdminEvent, 'url' => "{$_SERVER['SCRIPT_NAME']}?addAdminEvent=1", 'icon' => 'fa-plus-circle', 'show' => $is_admin, 'button-class' => 'btn-success', 'level' => 'primary-label'), array('title' => $langiCalExport, 'url' => "icalendar.php", 'icon' => 'fa-calendar', 'level' => 'primary'))); } /* display events */ $day = isset($_GET['day']) ? intval($_GET['day']) : null;
* * Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ $require_login = TRUE; require_once '../include/init.php'; require_once 'include/lib/references.class.php'; if(isset($_GET['cid']) && isset($_GET['tid'])){ error_log($_GET['cid']); list($c, $cid) = explode(':',$_GET['cid']); $course = intval($cid); $module = intval($_GET['tid']); echo json_encode(References::get_course_module_items($course, $module)); } else if(isset($_GET['cid'])){ list($c, $cid) = explode(':',$_GET['cid']); $course = intval($cid); echo json_encode(References::get_course_modules($course)); } else if(isset($_GET['tid'])){ echo json_encode(References::get_general_module_items(intval($_GET['tid']))); } else { echo json_encode(References::get_user_courselist()); }