function _tripadm_load() { $ufile = new Modele('trip_userfiles'); try { $ufile->fetch($_GET['file']); } catch (SQLFetchNotFound $e) { redirect('syscore', 'invcall'); } // if ($ufile->raw_tu_user != $_SESSION['user']['user_id']) { // redirect('syscore', 'forbidden'); // } $ufile->assignTemplate('ufile'); $ufile->tu_trip->assignTemplate('trip'); return $ufile; }
function section_admin_ml_noadmin() { global $tpl, $srcdir, $pdo; include $srcdir . '/libs/GoogleApi.php'; $api = new GoogleApi(); $mdl = new Modele('sections'); $mdl->fetch($_REQUEST['section']); $mdl->assignTemplate('section'); $lnk = new Modele('section_ml'); $lnk->find(array('sm_section' => $_REQUEST['section'], 'sm_ml' => $_REQUEST['ml'])); $mbr = $api->getGroupMemberDetails($_REQUEST['ml'], $_REQUEST['member']); if (!$lnk->next() || strpos($_REQUEST['member'], 'save_') === 0 || $mbr->type == "GROUP") { modexec('syscore', 'forbidden'); } $api->setGroupMemberLevel($lnk->sm_ml, $_REQUEST['member'], 'MEMBER'); redirect("section", "admin_ml", array("hsuccess" => 1, "section" => $_REQUEST['section'], "ml" => $lnk->sm_ml)); }
function developer_edit() { $mdl = new Modele('api_clients'); $mdl->fetch($_REQUEST['appli']); if (isset($_POST['callback'])) { $mdl->ac_callback = $_POST['callback']; redirect('developer', 'view', array('appli' => $_REQUEST['appli'], 'hsuccess' => '1')); } $mdl->assignTemplate('cli'); display(); }
function admin_note_downbulletin() { global $pdo, $root; $mdl = new Modele("periods"); $mdl->fetch($_GET['id']); $mdl->assignTemplate('bulletin'); require $root . 'libs' . DS . 'bulletins' . DS . $mdl->period_generator . DS . 'bulletin.php'; bulletin_download($_GET['id']); quit(); }
function trip_search() { global $tpl; $mdl = new Modele('trips'); $mdl->fetch($_GET['trip']); $mdl->assignTemplate('trip'); if (isset($_POST['mailing'])) { redirect('trip', 'mail', array('search' => $_POST['search'], 'field' => $_POST['field'], 'value' => $_POST['value'])); } else { $search = _trip_search_user($_POST['search'], $_GET['field'], $_GET['value']); while ($line = $search->fetch()) { $tpl->append('ufiles', $line); } $tpl->assign('search', $_POST['search']); $tpl->assign('field', $_GET['field']); $tpl->assign('value', $_GET['value']); } display(); }
function event_addpoints() { global $tpl, $pdo; $event = new Modele('events'); $event->fetch($_GET['event']); $event->assignTemplate('event'); $section = new Modele('sections'); $section->fetch($_REQUEST['section']); $section->assignTemplate('section'); $queryFields = array('part_duration', 'part_title', 'part_justification'); $mdl = new Modele('participations'); $tpl->assign('form', $mdl->edit($queryFields)); if (isset($_POST['edit'])) { $data = array('part_section' => $section->section_id, 'part_attribution_date' => date('Y-m-d'), 'part_status' => 'SUBMITTED', 'part_event' => $event->getKey()); foreach ($queryFields as $field) { $data[$field] = $_POST[$field]; } if (!$mdl->addFrom($data)) { redirect('section', 'details', array('section' => $section->section_id, 'hsuccess' => '0')); } $sql = $pdo->prepare('SELECT * FROM event_staff LEFT JOIN users ON user_id = est_user WHERE est_section = ? AND est_event = ?'); $sql->bindValue(1, $section->getKey()); $sql->bindValue(2, $event->getKey()); $sql->execute(); $mdlMark = new Modele('marks'); $dataMark = array('mark_participation' => $mdl->getKey()); while ($user = $sql->fetch()) { $markOk = $_POST['staff-' . $user['user_id'] . '-ok']; $markPeriod = $_POST['staff-' . $user['user_id'] . '-period']; $markMark = $_POST['staff-' . $user['user_id'] . '-mark']; if ($markOk == 'YES') { $dataMark['mark_user'] = $user['user_id']; $dataMark['mark_period'] = $markPeriod; $dataMark['mark_mark'] = $markMark; $mdlMark->addFrom($dataMark); } } redirect('event', 'staff_activities', array('event' => $event->getKey(), 'section' => $section->section_id, 'hsuccess' => '1')); } $types = new Modele('user_types'); $types->find(); $repPeriods = array(); while ($type = $types->next()) { $periods = $pdo->prepare('SELECT * FROM periods WHERE period_start < NOW() AND period_end > NOW() AND period_type = ? AND period_state = "ACTIVE"'); $periods->bindValue(1, $types->ut_id); $periods->execute(); while ($period = $periods->fetch()) { if (!isset($repPeriods[$types->ut_id])) { $repPeriods[$types->ut_id] = array(); } $repPeriods[$types->ut_id][] = $period; } } $tpl->assign('periods', $repPeriods); $sql = $pdo->prepare('SELECT * FROM event_staff LEFT JOIN users ON user_id =est_user WHERE est_section = ? AND est_event = ? ORDER BY user_name'); $sql->bindValue(1, $section->getKey()); $sql->bindValue(2, $event->getKey()); $sql->execute(); while ($user = $sql->fetch()) { $tpl->append('staffs', $user); } display(); }
function _tripusr_load() { global $tpl; $ufile = new Modele('trip_userfiles'); try { $ufile->fetch($_GET['file']); } catch (SQLFetchNotFound $e) { redirect('syscore', 'invcall'); } if ($ufile->raw_tu_user != $_SESSION['user']['user_id']) { redirect('syscore', 'forbidden'); } $mdl = new Modele('trips'); $mdl->fetch($ufile->raw_tu_trip); $tpl->assign('delete', new DateTime($mdl->tr_retractdate) >= new DateTime("now")); $ufile->assignTemplate('ufile'); $ufile->tu_trip->assignTemplate('trip'); return $ufile; }