public static function notes() { $notes = notes::fetch(); if (!is_array($notes)) { $notes = array(); } return json_encode($notes); }
public static function add(Model_User $user, Model_Achievement $achievement) { $userachievement = ORM::factory('Userachievement'); $userachievement->user_id = $user->id; $userachievement->achievement_id = $achievement->id; $userachievement->created = time(); $userachievement->save(); notes::achievement($achievement->triggertext); }
public function action_twittercallback() { if (arr::get($_GET, 'denied', false)) { notes::error('Seems like you didn\'t want to log in with Twitter anyway. Feel free to try again if it was a mistake!'); site::redirect(); } $token = arr::get($_GET, 'oauth_token', false); $verifier = arr::get($_GET, 'oauth_verifier', false); if (!$token || !$verifier) { notes::error('Something went wrong in the process, and we didn\'t get the expected data back from Twitter. Please try again'); site::redirect(); } $connection = new TwitterOAuth(arr::get($this->creds, 'key'), arr::get($this->creds, 'secret'), Session::instance()->get_once('twitter_oauth_token'), Session::instance()->get_once('twitter_oauth_token_secret')); $token = $connection->getAccessToken($verifier); $oauth_token = arr::get($token, 'oauth_token', ''); $oauth_token_secret = arr::get($token, 'oauth_token_secret', ''); $user_id = arr::get($token, 'user_id', ''); $screen_name = arr::get($token, 'screen_name', ''); $oauth = ORM::factory('Oauth')->where('type', '=', 'twitter')->where('token', '=', $oauth_token)->find(); if ($oauth->loaded()) { try { $user = $oauth->user; user::force_login($user); } catch (exception $e) { if ($user->loaded()) { if (user::logged()) { // Random error, but user got logged in. We don't care, YOLO! } else { notes::error('Whoops! Something wen\'t wrong and we couldn\'t log you in. Please try again or send us a message if the problem persists.'); Kohana::$log->add(Log::ERROR, '1. Couldnt log user in: ' . $e->getMessage()); } } } site::redirect('write'); } else { try { $user = ORM::factory('User'); $user->username = $screen_name; $user->validation_required(false)->save(); $user->add_role('login'); $oauth = ORM::factory('Oauth'); $oauth->user_id = $user->id; $oauth->type = 'twitter'; $oauth->token = $oauth_token; $oauth->token_secret = $oauth_token_secret; $oauth->service_id = $user_id; $oauth->screen_name = $screen_name; $oauth->save(); user::force_login($user); } catch (exception $e) { Kohana::$log->add(Log::ERROR, '2. Couldnt create user: '******'Whoops! Something wen\'t wrong and we couldn\'t log you in. Please try again or send us a message if the problem persists.'); } site::redirect('/write'); } }
public function action_imgedit() { $file = ORM::factory('file', $this->request->param('id')); if (!$file->loaded()) { notes::add('error', 'Filen blev ikke fundet!'); cms::redirect('files'); } $this->load_css('media/libs/jcrop/css/jquery.Jcrop.min.css'); $this->load_script('media/libs/jcrop/js/jquery.Jcrop.min.js'); $this->bind('file', $file); }
public function action_write() { $errors = false; $page = false; if (user::logged()) { $page = $this->request->param('page'); if ($_POST && strlen(arr::get($_POST, 'content', '')) > 0) { $content = arr::get($_POST, 'content', ''); if ($page->type == 'page') { $raw = $page->rawcontent(); if ($raw != "") { $content = $raw . "\n" . $content; } } else { if ($page->type == 'autosave') { $page->type = 'page'; } } try { $page->wordcount = site::count_words($content); $page->content = $content; if ($page->wordcount >= 750 && !(bool) $page->counted) { user::update_stats($page); $page->counted = 1; } $page->duration = $page->duration + (time() - arr::get($_POST, 'start', 999)); $page->update(); $oldsaves = ORM::factory('Page')->where('type', '=', 'autosave')->where('user_id', '=', user::get()->id)->find_all(); if ((bool) $oldsaves->count()) { foreach ($oldsaves as $old) { $old->delete(); } } achievement::check_all(user::get()); notes::success('Your page has been saved!'); //site::redirect('write/'.$page->day); } catch (ORM_Validation_Exception $e) { $errors = $e->errors('models'); } } } else { if ($_POST) { notes::error('You must be logged in to save your page. Please log in and submit again.'); } } $this->bind('errors', $errors); $this->bind('page', $page); $this->template->daystamp = $this->request->param('daystamp'); $this->template->page = $page; seo::instance()->title("Write Your Morning Pages"); seo::instance()->description("Morning Pages is about writing three pages of stream of consciousness thought every day. Become a better person by using MorninPages.net"); }
public function action_show() { $token = $this->request->param('id'); $mail = ORM::factory('Mail')->where('token', '=', $token)->find(); if ($mail->loaded()) { $view = View::factory('templates/mail'); $view->mail = $mail; echo $view; } else { notes::add('error', 'Mail not found!'); site::redirect(''); die; } }
public function require_login($msg = true, $redirect = false) { if ($msg === true) { $msg = 'You must be logged in to see this page'; } if (!user::logged()) { if ($msg) { notes::error($msg); } if ($redirect) { site::redirect($redirect); } else { user::redirect('login'); } } }
public function action_contact() { $errors = false; if ($_POST) { $val = Validation::factory($_POST); $val->rule('sprot', 'exact_length', array(':value', 1)); $val->rule('email', 'not_empty'); $val->rule('email', 'email'); $val->rule('suggestion', 'not_empty'); if ($val->check()) { notes::success('Your message has been sent and we will get back to you as soon as possible. Thanks!'); $mail = mail::create('suggestion')->to('*****@*****.**')->from(arr::get($_POST, 'email', ''))->content(arr::get($_POST, 'suggestion') . '<br /><br />.E-mail: ' . arr::get($_POST, 'email', ''))->subject('Message to ' . site::option('sitename'))->send(); site::redirect('contact'); } else { $errors = $val->errors('suggestions'); } } $this->bind('errors', $errors); seo::instance()->title("Contact Morning Pages"); seo::instance()->description("Feel free to contact MorningPages.net if you have questions or concerns about your account, the site or for more information regarding your Morning Pages."); }
public function action_talk() { $tag = $this->request->param('tag'); $talk = $this->request->param('talk'); if (user::logged()) { // Iterate views if ($talk->user_id != user::get()->id) { $talk->views = $talk->views + 1; try { $talk->save(); } catch (ORM_Validation_Exception $e) { //var_dump($e->errors()); } } // Set when the user last saw the topic $user = user::get(); $viewed = $user->talkviews->where('talk_id', '=', $talk->id)->find(); if (!$viewed->loaded()) { $viewed->user_id = $user->id; $viewed->talk_id = $talk->id; } $viewed->last = time(); $viewed->save(); } $replies = $talk->replies->where('op', '!=', 1); $counter = $talk->replies->where('op', '!=', 1); $limit = Kohana::$config->load('talk')->get('pagination_limit'); $numreplies = $counter->count_all(); $numpages = ceil($numreplies / $limit); $page = (int) arr::get($_GET, 'page', 0); if ($_POST) { $this->require_login(); $reply = ORM::factory('Talkreply'); $reply->values($_POST); $reply->user_id = user::get()->id; $reply->talk_id = $talk->id; try { $reply->save(); $page = $numpages; $talk->last_reply = time(); $talk->save(); $subscriptions = $talk->subscriptions->find_all(); if ((bool) $subscriptions->count()) { foreach ($subscriptions as $subscription) { if ($subscription->user_id != $reply->user_id) { mail::create('talkreplyposted')->to($subscription->user->email)->tokenize(array('username' => $subscription->user->username, 'sendername' => $reply->user->username, 'title' => $talk->title, 'reply' => $reply->content, 'link' => HTML::anchor(URL::site($talk->url() . '?page=' . $page . '#comment-' . $reply->id, 'http'), $talk->title)))->send(); } } } $vote = ORM::factory('User_Talkvote'); $vote->type = 'talkreply'; $vote->user_id = user::get()->id; $vote->object_id = $reply->id; $vote->save(); notes::success('Your reply has been posted.'); site::redirect($talk->url() . '?page=' . $page . '#comment-' . $reply->id); } catch (ORM_Validation_Exception $e) { notes::error('Whoops! Your submission contained errors. Please review it and submit again'); $errors = $e->errors(); } } if ($page < 1) { $page = 1; } if ($page > $numpages) { $page = $numpages; } $replies = $replies->limit($limit); if ($page - 1 > 0) { $replies = $replies->offset($limit * ($page - 1)); } $replies = $replies->find_all(); $this->bind('tag', $tag); $this->bind('talk', $talk); $this->bind('replies', $replies); $this->bind('tags', ORM::factory('Talktag')->find_all()); $this->bind('numpages', $numpages); $this->bind('currentpage', $page); seo::instance()->title($talk->title); seo::instance()->description("Talk About Morning Pages, or anything else you might find interesting. Use this area to ask questions, make friends, or find out information about Morning Pages."); }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/notes.php'; $note = notes::GetNotes((int) $_SESSION['uid'], (int) $project['user_id'], $error); if ($note['n_text']) { $noteText = reformat($note['n_text'], 22, 0, 0, 1, 22); $noteBtn = 'Редактировать'; } else { $noteText = ''; $noteBtn = 'Добавить'; } ?> <div id="noteTextBlock" class="b-note b-note_inline-block b-fon b-fon_bg_ffeda9"> <div class="b-fon__b1"></div> <div class="b-fon__b2"></div> <div class="b-fon__body b-fon__body_pad_5_10"> <div class="b-note__txt"> <strong class="b-note__bold">Ваша заметка: </strong><span id="noteText"><?php echo $noteText; ?> </span> <a id="noteEditBtn" class="b-note__link b-note__link_bordbot_0f71c8" href="javascript:void(0)"><?php echo $noteBtn; ?> </a> </div> </div> <div class="b-fon__b2"></div> <div class="b-fon__b1"></div> </div> <div id="noteEditBlock" class="b-note b-fon b-fon_bg_ffeda9 b-fon_hide" style=" max-width: 600px;"> <div class="b-fon__b1"></div>
public static function exportNotes($pack) { $pack->auth->game_id = $pack->game_id; $pack->auth->permission = "read_write"; if (!editors::authenticateGameEditor($pack->auth)) { return new return_package(6, NULL, "Failed Authentication"); } $export = notes::getNotesForGame($pack); $tmp_export_folder = $pack->game_id . "_notebook_export_" . date("mdY_Gis"); $fs_tmp_export_folder = Config::v2_gamedata_folder . "/" . $tmp_export_folder; if (file_exists($fs_tmp_export_folder)) { util::rdel($fs_tmp_export_folder); } mkdir($fs_tmp_export_folder, 0777); $jsonfile = fopen($fs_tmp_export_folder . "/export.json", "w"); fwrite($jsonfile, json_encode($export)); fclose($jsonfile); util::rcopy(Config::v2_gamedata_folder . "/" . $pack->game_id, $fs_tmp_export_folder . "/gamedata"); util::rzip($fs_tmp_export_folder, $fs_tmp_export_folder . ".zip"); util::rdel($fs_tmp_export_folder); return new return_package(0, Config::v2_gamedata_www_path . "/" . $tmp_export_folder . ".zip"); }
<?php if (!defined('IN_STDF')) { header('HTTP/1.0 404 Not Found'); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/notes.php'; $oNotes = new notes(); $aNote = $oNotes->GetNoteInt($_SESSION['uid'], $user->uid, $error); ?> <?php if ($aNote) { ?> <div class="bBD" id="zametkaBD"> <div id="zametka" class="b-layout b-layout_pad_10 b-layout_bord_ffeda9 b-layout_bordrad_1 b-fon_bg_fff9bf_hover b-layout_hover "> <?php /*<a href="javascript:void(0);" onclick="if(confirm('Вы действительно хотите удалить заметку?')){xajax_saveHeaderNote('<?=$name?>','');}"><img src="/images/btn-remove2.png" width="11" height="11" alt="" /></a>*/ ?> <a class="b-icon b-icon__edit b-icon_float_right b-layout_hover_show" href="javascript:void(0);" onclick="headerNoteForm();"></a> <div class="b-layout__txt b-layout__txt_bold b-layout__txt_padbot_10">Ваша заметка</div> <div class="b-layout__txt b-layout__txt_fontsize_11"><?php echo reformat($aNote['n_text'], 24, 0, 0, 1, 24); ?> </div> </div> </div> <?php } else { ?> <div id="zametka" class="b-layout__txt b-layout__txt_padtop_5 b-layout__txt_inline-block"><span class="b-icon b-icon__cont b-icon__cont_note" ></span><a class="b-layout__link b-layout__link_bordbot_dot_0f71c8 b-layout__link_fontsize_13" href="javascript:void(0);" onclick="$('zametka_fmr').toggleClass('b-layout_hide');">Оставить заметку</a></div>
if ($ids) { $recsProfi = $user->getUsersProfi($ids); } $pt = 0; $k = 0; $allCnt = $realCnt = count($recs); if ($allCnt > $limit) { $allCnt = $limit; } $iOdd = ceil($allCnt / 2); notes::getNotesUsers($recs, $notes, 0, $iOdd, 3); ?> </div> <div class="izbr-even"> <?php notes::getNotesUsers($recs, $notes, $iOdd, $allCnt, 3); $pt = 15; ?> </div><!--izbr-even--> </div><!-- izbr --> </td> </tr> <?php if ($realCnt > $limit) { ?> <tr> <td style="padding: 0 19px 19px"> <a class="blue" href='<?php echo $rpath; ?> all/?mode=3'><b>Все (<?php
function _notes_dxclass() { // // main method for notes diagnosis class library // calls form_dxclass, process_dxclass, display_dxclass // if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } // always check dependencies if ($exitinfo = $this->missing_dependencies('notes')) { return print($exitinfo); } $n = new notes; if ($post_vars["submitclass"]) { $n->process_dxclass($menu_id, $post_vars, $get_vars); } $n->form_dxclass($menu_id, $post_vars, $get_vars); $n->display_dxclass($menu_id); }
function get_surgical_history() { if (func_num_args() > 0) { $arg_list = func_get_args(); $type = $arg_list[0]; $remarks = $arg_list[1]; } print "<tr><td>"; print "<input id='operation' type='text' name='surgicalname' style='width:227px' placeholder='Operation'>"; print " <input id='operationdate' type='text' style='width:88px' name='surgicaldate' placeholder='mm-dd-yyyy'>"; print " <a href=\"javascript:show_calendar4('document.form_history.surgicaldate', document.form_history.surgicaldate.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; print "<span style='margin:0 auto; display:inline-block;'><input id='save' type='submit' name='submitnotes' value='Add Surgical History'></span>"; print "<input id='recordID' type='hidden' name='recordID' value=''>"; print "<br/><br/><hr></hr><br/>" . notes::edit_surgical_history() . "</td></tr>"; //notes::add_surgical_history($post_vars,$get_vars,$_POST['surgicalname'],$_POST['surgicaldate']); }
/** * Получение списка предложений по конкретному проекту. * * @param integer $count возвращает количество предложений * @param integer $prj_id id проекта * @param string $show_all признак отображения всех (true) или только открытых (false) предложений проекта * @param string $sort сортировка списка предложений * @param string $type выбор предложений одного типа ('o' - все, 'c' - выбранных в кандидаты, 'r' - отказанных, 'nor' - все кроме отказавшихся, 'i' - исполнитель) * * @return array список предложений */ public function GetPrjOffers(&$count, $prj_id, $limit, $offset = 0, $user_id = 0, $show_all = false, $sort = 'date', $type = 'a') { global $DB; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/notes.php'; $user_id = intval($user_id); $limit = $limit == 'ALL' ? $limit : intval($limit); $offset = intval($offset); $limit_str = " LIMIT {$limit} OFFSET {$offset}"; $bPermissions = hasPermissions('projects'); // исключаем заблокированные предложения $sel_blocked = ', pb.reason as blocked_reason, pb.blocked_time, COALESCE(pb.src_id::boolean, false) as is_blocked'; $join_blocked = 'LEFT JOIN projects_offers_blocked pb ON po.id = pb.src_id '; if ($bPermissions) { $sel_blocked .= ', admins.login as admin_login, admins.uname as admin_uname, admins.usurname as admin_usurname'; $join_blocked .= 'LEFT JOIN users as admins ON pb.admin = admins.uid '; $where_blocked = ''; $and_blocked = ''; } else { $where_blocked = " (po.user_id = {$user_id} OR pb.src_id IS NULL) "; $and_blocked = ' AND ' . $where_blocked; } //@todo: Рекомендуется вынести completed_cnt в users_counters таблицу и с ней соединяться //тем более, что в ней уже есть кол-во по новой БС reserves_completed_cnt //нужно добавить поле по старой БС и пересчитать туда if ($type == 'i') { $sql = "SELECT\n po.*,\n fl.uid, fl.login, fl.uname, fl.usurname, fl.photo, fl.photosm, fl.spec, fl.is_pro, fl.is_team, fl.is_pro_test, fl.is_profi, uc.ops_frl_plus as ops_plus, uc.ops_frl_null as ops_null, uc.ops_frl_minus as ops_minus, fl.role, fl.warn, fl.is_banned, fl.ban_where, rating_get(fl.rating, fl.is_pro, fl.is_verify, fl.is_profi) as rating, fl.is_verify, fl.reg_date, fl.modified_time, fl.photo_modified_time,\n p.name AS spec_name,\n cr.country_name,\n ct.city_name, \n COALESCE(sbr_meta.completed_cnt, 0) + COALESCE(uc.reserves_completed_cnt, 0) AS completed_cnt, -- старые БС + новые БС\n uc.ops_emp_plus + uc.ops_frl_plus as ops_all_plus, uc.ops_emp_null + uc.ops_frl_null as ops_all_null, uc.ops_emp_minus + uc.ops_frl_minus as ops_all_minus,\n uc.ops_emp_plus, uc.ops_emp_null, uc.ops_emp_minus,\n uc.sbr_opi_plus, uc.sbr_opi_null, uc.sbr_opi_minus,\n uc.paid_advices_cnt + uc.sbr_opi_plus + uc.ops_emp_plus + uc.tu_orders_plus + uc.projects_fb_plus as opinions_plus,\n uc.sbr_opi_minus + uc.ops_emp_minus + uc.tu_orders_minus + uc.projects_fb_minus as opinions_minus\n {$sel_blocked} \n FROM (SELECT por.*, exec_id, pr.user_id as p_user_id FROM projects AS pr\n LEFT JOIN projects_offers as por ON por.project_id=pr.id AND (pr.exec_id =por.user_id)\n WHERE pr.id = '{$prj_id}' AND (por.user_id > 0)" . ($show_all ? '' : " AND (por.only_4_cust='f')") . ') AS po INNER JOIN freelancer as fl ON (po.exec_id=fl.uid' . ($bPermissions ? '' : ' AND fl.is_banned::integer = 0') . ")\n {$join_blocked} \n LEFT JOIN professions p ON p.id=fl.spec\n LEFT JOIN users_counters uc ON uc.user_id = fl.uid\n LEFT JOIN sbr_meta ON sbr_meta.user_id = fl.uid -- старые БС\n LEFT JOIN country cr ON cr.id=fl.country\n LEFT JOIN city ct ON ct.id=fl.city\n " . ($user_id == 0 ? "WHERE {$where_blocked}" : 'WHERE (fl.uid<>' . $user_id . ") {$and_blocked}"); $ret = $DB->rows($sql); $error = $DB->error; if ($error) { $error = parse_db_error($error); } else { if ($ret) { foreach ($ret as &$value) { // Выбираем вложения. if ($value['id']) { $sql = 'SELECT a.id, a.prev_pict as prev, a.pict ' . 'FROM projects_offers_attach AS a ' . 'WHERE a.offer_id= ?i '; $value['attach'] = $DB->rows($sql, $value['id']); } } } } } else { switch ($sort) { default: case 'date': $order = ' ORDER BY (fl.is_verify AND fl.is_pro) DESC, fl.is_pro DESC, fl.is_verify DESC, post_date DESC'; break; case 'rating': $order = ' ORDER BY rating DESC, fl.is_pro DESC, post_date DESC'; break; case 'opinions': $order = ' ORDER BY ssum DESC, fl.is_pro DESC, post_date DESC'; break; case 'time': $order = ' ORDER BY (((time_from = 0) OR (time_from IS NULL)) AND ((time_to = 0) OR (time_to IS NULL))) ASC, time_from_days ASC, time_to_days ASC, is_pro DESC, post_date DESC'; break; case 'cost': $order = ' ORDER BY (((cost_from = 0) OR (cost_from IS NULL)) AND ((cost_to = 0) OR (cost_to IS NULL))) ASC, usd_cost_from DESC, usd_cost_to DESC, is_pro DESC, post_date DESC'; break; } switch ($type) { default: case 'a': $filter = ''; break; case 'o': $filter = ' AND NOT po.selected AND NOT po.refused AND NOT po.frl_refused AND COALESCE(pr.exec_id,0)<>fl.uid'; break; case 'c': $filter = ' AND po.selected'; break; case 'r': $filter = ' AND po.refused'; break; case 'nor': $filter = ' AND NOT po.frl_refused'; break; case 'fr': $filter = ' AND po.frl_refused'; break; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/project_exrates.php'; $project_exRates = project_exrates::GetAll(); $sql = "SELECT\n CASE po.cost_type\n WHEN 0 THEN po.cost_from\n WHEN 1 THEN po.cost_from*{$project_exRates[32]}\n WHEN 2 THEN po.cost_from*{$project_exRates[42]}\n WHEN 3 THEN po.cost_from*{$project_exRates[12]}\n END as usd_cost_from,\n CASE po.cost_type\n WHEN 0 THEN po.cost_to\n WHEN 1 THEN po.cost_to*{$project_exRates[32]}\n WHEN 2 THEN po.cost_to*{$project_exRates[42]}\n WHEN 3 THEN po.cost_to*{$project_exRates[12]}\n END as usd_cost_to,\n\n CASE po.time_type\n WHEN 0 THEN po.time_from\n WHEN 1 THEN po.time_from * 30\n WHEN 2 THEN po.time_from * 356\n ELSE po.time_from\n END as time_from_days,\n CASE po.time_type\n WHEN 0 THEN po.time_to\n WHEN 1 THEN po.time_to * 30\n WHEN 2 THEN po.time_to * 356\n ELSE po.time_to\n END as time_to_days,\n po.*, pr.user_id AS p_user_id,\n fl.uid, fl.login, fl.uname, fl.usurname, fl.photo, fl.photosm, fl.spec, fl.is_profi, fl.is_pro, fl.is_team, fl.is_pro_test, \n uc.ops_frl_plus as ops_plus, \n uc.ops_frl_null as ops_null, \n uc.ops_frl_minus as ops_minus, \n fl.role, fl.warn, fl.is_banned, fl.ban_where, \n rating_get(fl.rating, fl.is_pro, fl.is_verify, fl.is_profi) as rating, \n zin(uc.ops_emp_plus) + zin(uc.sbr_opi_plus) - zin(uc.ops_emp_minus) - zin(uc.sbr_opi_minus) as ssum, \n fl.is_verify, fl.reg_date, fl.modified_time, fl.photo_modified_time,\n p.name AS spec_name,\n cr.country_name,\n COALESCE(sbr_meta.completed_cnt, 0) + COALESCE(uc.reserves_completed_cnt, 0) AS completed_cnt, -- старые БС + новые БС\n ct.city_name,\n uc.ops_emp_plus + uc.ops_frl_plus as ops_all_plus, uc.ops_emp_null + uc.ops_frl_null as ops_all_null, uc.ops_emp_minus + uc.ops_frl_minus as ops_all_minus,\n uc.ops_emp_plus, uc.ops_emp_null, uc.ops_emp_minus,\n uc.sbr_opi_plus, uc.sbr_opi_null, uc.sbr_opi_minus,\n uc.paid_advices_cnt + uc.sbr_opi_plus + uc.ops_emp_plus + uc.tu_orders_plus + uc.projects_fb_plus as opinions_plus,\n uc.sbr_opi_minus + uc.ops_emp_minus + uc.tu_orders_minus + uc.projects_fb_minus as opinions_minus\n {$sel_blocked} \n FROM projects_offers AS po\n LEFT JOIN projects pr ON pr.id=po.project_id\n INNER JOIN freelancer as fl ON po.user_id=fl.uid\n {$join_blocked} \n LEFT JOIN users_counters uc ON uc.user_id = fl.uid\n LEFT JOIN professions p ON p.id=fl.spec\n LEFT JOIN country cr ON cr.id=fl.country\n LEFT JOIN city ct ON ct.id=fl.city\n LEFT JOIN sbr_meta ON sbr_meta.user_id = fl.uid -- старые БС\n WHERE (po.project_id = ?i ) AND (po.user_id > 0) {$and_blocked}" . ($bPermissions ? '' : ' AND fl.is_banned::integer = 0') . ($show_all ? '' : " AND (po.only_4_cust='f')") . ($user_id == 0 ? '' : ' AND (fl.uid<>' . $user_id . ')') . $filter . $order . $limit_str; $ret = $DB->rows($sql, $prj_id); $error = $DB->error; if ($error) { $error = parse_db_error($error); } else { //$ret = pg_fetch_all($res); $sql = "SELECT COUNT(*) as num\n FROM projects_offers AS po\n LEFT JOIN projects as pr ON po.project_id=pr.id\n INNER JOIN freelancer as fl ON po.user_id=fl.uid\n {$join_blocked} \n LEFT JOIN professions p ON p.id=fl.spec\n LEFT JOIN country cr ON cr.id=fl.country\n LEFT JOIN city ct ON ct.id=fl.city\n WHERE (po.project_id = ?i ) AND (po.user_id > 0) {$and_blocked}" . ($bPermissions ? '' : ' AND fl.is_banned::integer = 0') . ($show_all ? '' : " AND (po.only_4_cust='f')") . ($user_id == 0 ? '' : ' AND (fl.uid<>' . $user_id . ')') . $filter; $count = $DB->val($sql, $prj_id); if ($count && $ret) { foreach ($ret as &$value) { // Выбираем вложения. if ($value['id']) { $sql = 'SELECT a.id, a.prev_pict as prev, a.pict ' . 'FROM projects_offers_attach AS a ' . 'WHERE a.offer_id= ?i'; $value['attach'] = $DB->rows($sql, $value['id']); } } } } } // временное решение для plproxy. очень не красиво, но пока не перенесется большая часть таблиц, // придется видимо оставить так if (!empty($ret)) { $teams = new teams(); $notes = new notes(); $t = $teams->teamsFavorites($ret[0]['p_user_id'], $error); $n = $notes->GetNotes($ret[0]['p_user_id'], 0, $error); for ($i = 0; $i < count($ret); ++$i) { // избранные $ret[$i]['in_team'] = 0; for ($j = 0; $j < count($t); ++$j) { if ($t[$j]['uid'] == $ret[$i]['uid']) { $ret[$i]['in_team'] = $ret[$i]['uid']; break; } } // заметки $ret[$i]['n_text'] = ''; for ($j = 0; $j < count($n); ++$j) { if ($n[$j]['to_id'] == $ret[$i]['uid']) { $ret[$i]['n_text'] = $n[$j]['n_text']; break; } } } } return $ret; }
function GetNote($login) { session_start(); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php"; $oUser = new users(); $nTargetId = $oUser->GetUid($sError, $login); $objResponse = new xajaxResponse(); $nuid = get_uid(false); $note = notes::GetNoteInt($nuid, $nTargetId, $err); $text = htmlspecialchars_decode($note['n_text']); $text = str_replace("'", "'", $text); $s = "\n \$('note_rating').set('value', '{$note['rating']}');\n f = document.getElement('div.uprj-note.form-templ');\n f.getElements('input,textarea').set('disabled', false);\n "; $objResponse->script($s); $objResponse->assign('f_n_text', 'value', $text); return $objResponse; }
function delete_record($useUUID = false) { if (!$useUUID) { $whereclause = $this->buildWhereClause("notes.id"); } else { $whereclause = $this->buildWhereClause($this->maintable . ".uuid"); } //we need to check for incomplete repeatable child tasks $querystatement = "\n\t\t\t\tSELECT\n\t\t\t\t\t`notes`.`id`,\n\t\t\t\t\t`notes`.`parentid`,\n\t\t\t\t\t`notes`.`repeating`,\n\t\t\t\t\t`notes`.`completed`\n\t\t\t\tFROM\n\t\t\t\t\t`notes`\n\t\t\t\tWHERE\n\t\t\t\t\t(" . $whereclause . ")\n\t\t\t\t\tAND\n\t\t\t\t\t(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t`notes`.`createdby` = '" . $_SESSION["userinfo"]["id"] . "'\n\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t`notes`.`assignedtoid` = '" . $_SESSION["userinfo"]["uuid"] . "'\n\t\t\t\t\t\t)\n\t\t\t\t\t\tOR\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t'" . $_SESSION["userinfo"]["admin"] . "' = '1'\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t"; $repeatqueryresult = $this->db->query($querystatement); //repeat where applicable if ($this->db->numRows($repeatqueryresult)) { $thetable = new notes($this->db, "tbld:a4cdd991-cf0a-916f-1240-49428ea1bdd1"); $repeatArray = array(); $orphanArray = array(); while ($therecord = $this->db->fetchArray($repeatqueryresult)) { if ($therecord["parentid"] && $therecord["completed"] == 0) { $repeatArray[] = array("parentid" => $therecord["parentid"], "id" => $therecord["id"]); } elseif ($therecord["repeating"]) { $orphanArray[] = array("id" => $therecord["id"]); } //endif elseif } //endwhile foreach ($repeatArray as $repeat) { if (!in_array($repeat["parentid"], $orphanArray)) { if (!$thetable->newerRepeats($repeat["parentid"], $repeat["id"])) { $thetable->repeatTask($repeat["parentid"]); } } } //end foreach foreach ($orphanArray as $orphaner) { $thetable->resetRepeating($orphaner); } } //end if $querystatement = "\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`notes`\n\t\t\t\tWHERE\n\t\t\t\t\t(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t`notes`.`createdby` = '" . $_SESSION["userinfo"]["id"] . "'\n\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t`notes`.`assignedtoid` = '" . $_SESSION["userinfo"]["uuid"] . "'\n\t\t\t\t\t\t)\n\t\t\t\t\t\tOR\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t'" . $_SESSION["userinfo"]["admin"] . "' ='1'\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t\tAND\n\t\t\t\t\t(" . $whereclause . ")\n\t\t\t"; $queryresult = $this->db->query($querystatement); $message = $this->buildStatusMessage(); $message .= " deleted"; return $message; }
<?php // $t_role - роль пользователя, если не определена в заметке. // $name - логин пользователя require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/notes.php"; $nt = new notes(); $nrl = 0; $nuid = get_uid(false); $note = $nt->GetNote($nuid, $name, $error); if (!$note['n_text']) { if ($note_version == 2) { $text = 'Видеть написанное будете только вы.'; } else { $text = "Вы можете оставить заметку о пользователе. Видеть написанное будете только вы и никто другой."; } $nrl = 1; } else { $text = $note['n_text']; $text = reformat($text, 24, 0, 0, 1, 24); $t_role = $note['role']; } unset($s_role); if (substr($t_role, 0, 1) == '1') { $s_role = "_emp"; } else { $s_role = "_frl"; } if ($nrl) { $s_role = ""; } if (isset($inc)) {
Copyright Intermesh 2003 Author: Merijn Schering <*****@*****.**> Version: 1.0 Release date: 08 July 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ require "../../Group-Office.php"; $GO_SECURITY->authenticate(); $GO_MODULES->authenticate('notes'); require $GO_LANGUAGE->get_language_file('notes'); $page_title = $lang_modules['notes']; require $GO_MODULES->class_path . "notes.class.inc"; $notes = new notes(); //check for the addressbook module $ab_module = $GO_MODULES->get_module('addressbook'); if (!$ab_module || !($GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab_module['acl_write']))) { $ab_module = false; } else { require_once $ab_module['class_path'] . 'addressbook.class.inc'; $ab = new addressbook(); } $projects_module = $GO_MODULES->get_module('projects'); if ($projects_module) { require $projects_module['class_path'] . 'projects.class.inc'; } $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : ''; $note_id = isset($_REQUEST['note_id']) ? $_REQUEST['note_id'] : 0; $return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
public function action_edit() { $content = ORM::factory('Content', $this->request->param('id')); if (!$content->loaded()) { notes::add('error', 'Indholdet blev ikke fundet.'); //cms::redirect(); } $view = View::factory('Cms/Content/edit', array('content' => $content)); $tags = DB::select('tag_id')->from('contents_tags')->group_by('tag_id')->execute(); $alltags = array(); if ((bool) $tags->count()) { foreach ($tags as $tag) { $tag = ORM::factory('Tag', arr::get($tag, 'tag_id')); $alltags[] = array('title' => $tag->tag, 'id' => $tag->id, 'slug' => $tag->slug); } } reply::ok($view, 'contenttype-' . $content->contenttype_id, array('viewModel' => 'viewModels/Content/edit', 'alltags' => $alltags)); }
function FormSave($login, $text, $action, $rl, $num) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php"; session_start(); $objResponse = new xajaxResponse(); $action = trim($action); // Режем тег <script> $text = strip_only(trim($text), '<script>'); //$text = stripslashes($text); $text = change_q_x($text, FALSE, TRUE, "", false, false); if ($rl == '1') { $s_role = "_emp"; } else { $s_role = "_frl"; } if ($text == '') { $s_role = ""; } $noassign = 0; $nuid = get_uid(false); $user = new users(); $nTargetId = $user->GetUid($sError, $login); switch ($action) { case "add": if ($text) { $error = notes::Add($nuid, (int) $nTargetId, $text); } break; case "update": if ($text) { $error = notes::Update($nuid, (int) $nTargetId, $text); } else { $error = notes::DeleteNote($nuid, (int) $nTargetId); } break; default: $noassign = 1; } $text = stripslashes($text); $text = reformat($text, 24, 0, 0, 1, 24); if ($s_role == "") { $text = "Вы можете оставить заметку о пользователе. Видеть написанное будете только вы и никто другой."; } if (!$noassign) { $GLOBALS['xajax']->setCharEncoding("windows-1251"); $objResponse->assign("notetext" . $num, "innerHTML", $text); $objResponse->assign("notetd" . $num, "className", "note" . $s_role); if (!$s_role == "") { $objResponse->script("txt[" . $num . "] = '" . $text . "';"); } $objResponse->script("act[" . $num . "] = '" . ($s_role ? "update" : "add") . "';"); } return $objResponse; }
function display_consults() { if (func_num_args() > 0) { $arg_list = func_get_args(); $report_date = $arg_list[0]; $patient_id = $arg_list[1]; //a handler for the patient ID $end_report_date = $arg_list[2]; } $arr_contents = array(); $sql = "select c.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname,' ',p.patient_middle) patient_name, " . "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,1) patient_age, " . "p.patient_gender,date_format(c.consult_date,'%Y-%m-%d') as consult_date " . "from m_consult c, m_patient p " . "where c.patient_id = p.patient_id " . "and c.consult_date BETWEEN '{$report_date} 00:00:00' AND '{$end_report_date} 23:59:00' ORDER by c.consult_date ASC"; $result = mysql_query($sql) or die("Cannot query: 456 " . mysql_error()); if ($result) { if (mysql_num_rows($result)) { $header = array('PATIENT ID', 'PATIENT NAME / SEX / AGE', 'CONSULT DATE / ELAPSED TIME', 'ADDRESS', 'BRGY', 'FAMILY ID', 'PHILHEALTH ID', 'VITAL SIGNS', 'COMPLAINTS', 'DIAGNOSIS', 'TREATMENT'); $contents = array(); //print "<a href='../chits_query/pdf_reports/dailyservice_report.php'>PRINTER FRIENDLY VERSION</a><br/>"; print "<b><center>CONSULTS</center></b><br/>"; print "<table width='1000' cellspacing='0' cellpadding='2' style='border: 1px solid #000000'>"; print "<tr bgcolor='#FFCC33'>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['0']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['1']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['2']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['3']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['4']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['5']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['6']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['7']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['8']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['9']}</b></td>"; print "<td class='tinylight' valign='middle' align=center><b>{$header['10']}</b></td>"; print "</tr>"; while (list($pid, $consult_id, $pname, $age, $sex, $consult_date) = mysql_fetch_array($result)) { $inner_record = array(); if ($fid = family::get_family_id($pid)) { $addr = family::get_family_address($fid); $barangay_id = family::barangay_id($family_id); } else { $fid = 0; $barangay_id = 0; $addr = family::get_family_address($fid); } $phid = philhealth::get_philhealth_id($pid); $cc = notes::get_complaints($pid, $consult_date); $dx = notes::get_diagnosis_list($pid, $consult_date); $tx = notes::get_plan($pid, $consult_date); $q_brgy = mysql_query("SELECT c.barangay_name FROM m_family_members a, m_family_address b, m_lib_barangay c WHERE a.patient_id='{$pid}' AND a.family_id=b.family_id AND b.barangay_id=c.barangay_id") or die("Cannot query 451 " . mysql_error()); list($brgy) = mysql_fetch_array($q_brgy); //for displaying the vitals signs $selvitals = mysql_query("SELECT vitals_weight,vitals_temp,vitals_systolic,vitals_diastolic,vitals_heartrate,\n\t\t vitals_resprate, a.consult_id FROM m_consult a, m_consult_vitals b WHERE a.patient_id='{$pid}' AND a.consult_date BETWEEN '{$report_date}' AND '{$end_report_date}' AND a.consult_id=b.consult_id") or die(mysql_error()); $sel_elapsed = mysql_query("SELECT date_format(consult_date,'%m/%d/%Y %h:%i %p') as consult_start,date_format(consult_end,'%m/%d/%Y %h:%i %p') as consult_end, round((unix_timestamp(consult_end)-unix_timestamp(consult_date))/60,2) as consult_minutes FROM m_consult WHERE consult_id='{$consult_id}'") or die("Cannot query 531 " . mysql_error()); list($start, $end, $elapsed) = mysql_fetch_array($sel_elapsed); $elapsed_time = $this->get_str_elapsed($start, $end, $elapsed); $select_brgy = mysql_query("SELECT barangay_name from m_lib_barangay WHERE barangay_id='{$bgy}'") or die(mysql_error()); $resbrgy = mysql_fetch_array($select_brgy); $res_vitals = mysql_fetch_array($selvitals); $bp = empty($res_vitals[vitals_systolic]) && empty($res_vitals[vitals_diastolic]) ? '-' : $res_vitals[vitals_systolic] . '/' . $res_vitals[vitals_diastolic]; $count = mysql_num_rows($selvitals); $bgcolor = $bgcolor == "#FFFF99" ? "white" : "#FFFF99"; print "<tr bgcolor='{$bgcolor}'>"; print "<td class='tinylight' align=center>" . $pid . "</td>"; print "<td class='tinylight' align=center>" . $pname . " / " . $sex . " / " . $age . "</td>"; print "<td class='tinylight' align=center>" . $elapsed_time . "</td>"; print "<td class='tinylight' align=center>" . $addr . "</td>"; //print "<td class='tinylight' align=center>".$resbrgy[barangay_name]."</td>"; print "<td class='tinylight' align=center>" . $brgy . "</td>"; print "<td class='tinylight' align=center>" . ($fid == 0 ? "-" : $fid) . "</td>"; print "<td class='tinylight' align=center>" . ($phid == 0 ? "-" : $phid) . "</td>"; print "<td class='tinylight' align=center>BP: {$bp},\n\t\t HR: {$res_vitals['vitals_heartrate']},RR: {$res_vitals['vitals_resprate']},<br>\n\t\t Wt: {$res_vitals['vitals_weight']} kg,Temp: {$res_vitals['vitals_temp']}</td>"; // display the vital signs print "<td class='tinylight' align=center>" . $cc . "</td>"; print "<td class='tinylight' align=center>" . $dx . "</td>"; print "<td class='tinylight' align=center>" . $tx . "</td>"; print "</tr>"; $vitals_sign = "BP: " . $bp . ", HR: " . $res_vitals[vitals_heartrate] . ",RR: " . $res_vitals[vitals_resprate] . ", Wt: " . $res_vitals[vitals_weight] . "kg, Temp: " . $res_vitals[vitals_temp]; //array_push($inner_record,array($pid,$pname." / ".$sex." / ".$age,$addr,$resbrgy[barangay_name],$brgy,$fid,$phid,'BP: '.$bp.', '. //'HR: '.$res_vitals[vitals_heartrate].', RR: '. $res_vitals[vitals_resprate].', Wt:' $res_vitals[vitals_weight] kg.', Temp:'. $res_vitals[vitals_temp],$cc,$dx,$tx)); array_push($inner_record, array($pid, $pname . " / " . $sex . " / " . $age, $elapsed_time, $addr, $brgy, $fid, $phid, $vitals_sign, $cc, $dx, $tx)); array_push($contents, $inner_record); } print "</table>"; $_SESSION[tbl_header] = $header; $_SESSION[daily_service_contents] = $contents; $_SESSION[record_count] = mysql_num_rows($result); array_push($arr_contents, $header, $contents, mysql_num_rows($result)); } } return $arr_contents; }
*/ require_once "../../include/session.php"; require_once "include/fields.php"; require_once "include/tables.php"; require_once "include/notes.php"; if (isset($_GET["backurl"])) { $backurl = $_GET["backurl"]; if (isset($_GET["refid"]) && $_GET["tabledefid"]) { $backurl .= "?refid=" . getId($db, $_GET["tabledefid"], $_GET["refid"]); } elseif (isset($_GET["refid"])) { $backurl .= "?refid=" . $_GET["refid"]; } } else { $backurl = NULL; } $thetable = new notes($db, "tbld:a4cdd991-cf0a-916f-1240-49428ea1bdd1", $backurl); $therecord = $thetable->processAddEditPage(); if ($therecord["private"] && $therecord["createdby"] != $_SESSION["userinfo"]["id"] && !$_SESSION["userinfo"]["admin"]) { goURL("../../noaccess.php"); } if (isset($therecord["phpbmsStatus"])) { $statusmessage = $therecord["phpbmsStatus"]; } $attachedtableinfo = $thetable->getAttachedTableDefInfo($therecord["attachedtabledefid"]); $pageTitle = "Note/Task/Event"; $phpbms->cssIncludes[] = "pages/base/notes.css"; $phpbms->jsIncludes[] = "modules/base/javascript/notes.js"; //Form Elements //============================================================== $theform = new phpbmsForm(); $theform->onsubmit = "return submitForm(this)";
function _consult() { // // main consult API // executes with menu choice "Today's Patients" // static $patient; static $notes; static $lab; // always check dependencies if ($exitinfo = $this->missing_dependencies('healthcenter')) { return print($exitinfo); } mysql_query("ALTER TABLE `m_consult` DROP PRIMARY KEY , ADD PRIMARY KEY (`consult_id`)"); if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } if (!isset($patient)) { $patient = new patient; $notes = new notes; $lab = new lab; $drug = new drug; } if ($get_vars["patient_id"] && $get_vars["consult_id"]) { print "<table>"; print "<tr valign='top'><td>"; $this->patient_info($menu_id, $post_vars, $get_vars); print "</td></tr>"; print "</table>"; } else { if ($post_vars["submitpatient"]) { // processes form_patient and immediately // starts consult $patient->process_patient($menu_id, $post_vars, $get_vars); $this->process_consult($menu_id, $post_vars, $get_vars); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]); } // check if we are loading patient records or validating entry for // an existing patient in today's consult list if ($post_vars["submitconsult"] || $get_vars["enter_consult"] || $post_vars["confirm_add_consult"]) { //$post_vars["consult_id"] = $get_vars["enter_consult"]; // confirms consult for found patients $this->process_consult($menu_id, $post_vars, $get_vars); } if ($post_vars["submitsearch"]) { // lists down search results for patient $this->process_search($menu_id, $post_vars, $get_vars); } print "<table width='600'>"; if ($get_vars["consult_id"]) { print "<tr valign='top'><td colspan='2'>"; $this->patient_info($menu_id, $post_vars, $get_vars); print "</td></tr>"; print "<tr valign='top'><td colspan='2'>"; $this->patient_menu($menu_id, $post_vars, $get_vars); print "</td></tr>"; print "<tr valign='top'><td>"; // column 1 switch ($get_vars["ptmenu"]) { case "APPTS": appointment::_consult_appointment($menu_id, $post_vars, $get_vars); break; case "LABS": if ($post_vars["submitlab"] || $get_vars["delete_id"]) { $lab->process_send_request($menu_id, $post_vars, $get_vars); } $lab->form_send_request($menu_id, $post_vars, $get_vars); break; case "DETAILS": if ($get_vars["module"]) { $module_method = $get_vars["module"]."::_consult_".$get_vars["module"]."(\$menu_id, \$post_vars, \$get_vars);"; if (class_exists($get_vars["module"])) { eval("$module_method"); } } else { if ($post_vars["submitdetails"]) { $this->process_details($menu_id, $post_vars, $get_vars); } $this->form_visitdetails($menu_id, $post_vars, $get_vars); } break; case "VITALS": //$this->show_vitalsigns($menu_id, $post_vars, $get_vars); if ($post_vars["submitvitals"]) { $this->process_vitalsigns($menu_id, $post_vars, $get_vars, $_SESSION["userid"]); } $this->form_vitalsigns($menu_id, $post_vars, $get_vars); break; case "NOTES": $notes->_consult_notes($menu_id, $post_vars, $get_vars); break; case "DRUGS": $drug->_consult_drug($menu_id, $post_vars, $get_vars); break; case "CONSULT": $this->_consult_housekeeping($menu_id, $post_vars, $get_vars); break; } print "</td><td>"; // column 2 switch ($get_vars["ptmenu"]) { case "APPTS": appointment::display_consult_appointments($menu_id, $post_vars, $get_vars); break; case "LABS": // lab requests for this consult // flag if done $lab->display_requests($menu_id, $post_vars, $get_vars); break; case "VITALS": $this->display_vitals($menu_id, $post_vars, $get_vars); break; case "DETAILS": if ($get_vars["module"]) { // construct eval string $module_method = $get_vars["module"]."::_details_".$get_vars["module"]."(\$menu_id, \$post_vars, \$get_vars);"; if (class_exists($get_vars["module"])) { eval("$module_method"); } } else { $this->show_visitdetails($menu_id, $post_vars, $get_vars); $this->display_consults($menu_id, $post_vars, $get_vars); } break; case "NOTES": $notes->_details_notes($menu_id, $post_vars, $get_vars, $validuser, $isadmin); break; case "DRUGS": $drug->_details_drug($menu_id, $post_vars, $get_vars, $validuser, $isadmin); break; } print "</td></tr>"; print "<tr valign='top'><td colspan='2'>"; // display all patients confirmed with consults // CONSULTS TODAY DISPLAYED AT THE BOTTOM $this->consult_info($menu_id, $post_vars, $get_vars); print "</td></tr>"; } else { print "<tr valign='top'><td colspan='2'>"; // display all patients confirmed with consults print "<table>"; print "<tr><td>"; // CONSULTS TODAY $this->consult_info($menu_id, $post_vars, $get_vars); print "</td></tr>"; /* print "<tr><td>"; // REGISTERED PATIENTS TODAY $patient->patient_info($menu_id, $post_vars, $get_vars); print "</td></tr>"; */ print "</table>"; print "</td></tr>"; print "<tr valign='top'><td>"; $patient->newsearch($menu_id, $post_vars, $get_vars); print "</td><td>"; $patient->form_patient($menu_id, $post_vars, $get_vars); print "</td></tr>"; } print "</table>"; } }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/notes.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/notes.common.php"; $xajax->printJavascript('/xajax/'); $recoms = new teams(); $recs = array(); $head = ''; if ($_SESSION['uid']) { $note = notes::GetNotes($_SESSION['uid'], null, $error); if (count($note) > 0) { foreach ($note as $key => $value) { $notes[$value['to_id']] = $value; } } $type = 1; } switch ($mode) { case 1: // В избранном у работодателей. if (!is_emp($user->role) && ($user->blocks[3] || $uid == $user->uid)) { $recs = $recoms->teamsInEmpFavorites($user->login, $error); } if (is_emp($user->role) && ($user->blocks[4] || $uid == $user->uid)) { $recs = $recoms->teamsInEmpFavorites($user->login, $error); } $head = "<a href='/users/" . $user->login . "/'>" . $user->uname . " " . $user->usurname . "</a> [<a href='/users/" . $user->login . "/'>" . $user->login . "</a>] в избранном у работодателей"; break; case 2: // В избранном у фрилансеров.
function displayWeek($userid, $dayInWeek = null) { // Creates a week view calendar for the widget if (!$dayInWeek) { $dayInWeek = mktime(0, 0, 0); } $firstDay = $dayInWeek; $dayArray = localtime($firstDay, true); while ($dayArray["tm_wday"] != 0) { $firstDay = strtotime("yesterday", $firstDay); $dayArray = localtime($firstDay, true); } //endwhile //build the initial array $events = array(); $lastDay = strtotime("6 days", $firstDay); $tempDay = $firstDay; for ($i = 0; $i < 7; $i++) { $events["d" . $tempDay] = array(); $tempDay = strtotime("tomorrow", $tempDay); } //endfor //first lets get the regular events in the timeframe; $querystatement = "\n SELECT\n notes.id,\n notes.startdate,\n notes.starttime,\n notes.enddate,\n notes.endtime,\n notes.subject\n FROM\n notes\n WHERE\n (\n notes.private = 0\n OR notes.createdby=" . $userid . "\n )\n AND notes.type='EV'\n AND notes.repeating = 0\n AND notes.startdate >= '" . dateToString($firstDay, "SQL") . "'\n AND notes.startdate <= '" . dateToString($lastDay, "SQL") . "'"; $queryresult = $this->db->query($querystatement); while ($therecord = $this->db->fetchArray($queryresult)) { $events["d" . stringToDate($therecord["startdate"], "SQL")]["t" . stringToTime($therecord["starttime"], "24 Hour")][] = $therecord; } //next we do recurring events $querystatement = "\n SELECT\n notes.id,\n notes.startdate,\n notes.starttime,\n notes.enddate,\n notes.endtime,\n notes.subject,\n notes.repeattype,\n notes.repeatevery,\n notes.firstrepeat,\n notes.lastrepeat,\n notes.timesrepeated,\n notes.repeatontheday,\n notes.repeatontheweek,\n notes.repeateachlist,\n notes.repeatuntil,\n notes.repeattimes\n FROM\n notes\n WHERE\n repeating =1\n AND (\n notes.private = 0\n OR notes.createdby=" . $userid . "\n ) AND notes.type='EV'\n AND (\n notes.repeatuntil IS NULL\n OR notes.repeatuntil >= '" . dateToString($firstDay, "SQL") . "'\n )\n AND (\n notes.repeattimes IS NULL\n OR notes.repeattimes > notes.timesrepeated\n )"; $queryresult = $this->db->query($querystatement); $thetable = new notes($this->db, "tbld:a4cdd991-cf0a-916f-1240-49428ea1bdd1"); while ($therecord = $this->db->fetchArray($queryresult)) { $dateArray = $thetable->getValidInRange(stringToDate($therecord["startdate"], "SQL"), $lastDay, $therecord); foreach ($dateArray as $date) { if ($date >= $firstDay && $date <= $lastDay) { if ($therecord["enddate"]) { $therecord["enddate"] = dateToString($date + (stringToDate($therecord["enddate"], "SQL") - stringToDate($therecord["startdate"], "SQL")), "SQL"); } $therecord["startdate"] = dateToString($date, "SQL"); $events["d" . $date]["t" . stringToTime($therecord["starttime"], "24 Hour")][] = $therecord; } //endif } //endforeach } //endwhile $querystatement = "\n SELECT\n DECODE(password,'" . ENCRYPTION_SEED . "') AS decpass\n FROM\n users\n WHERE\n id=" . $_SESSION["userinfo"]["id"]; $queryresult = $this->db->query($querystatement); $passrec = $this->db->fetchArray($queryresult); $icallink = "?u=" . $_SESSION["userinfo"]["id"] . "&h=" . md5("phpBMS" . $_SESSION["userinfo"]["firstname"] . $_SESSION["userinfo"]["lastname"] . $_SESSION["userinfo"]["id"] . $passrec["decpass"]); ?> <input type="hidden" id="eventDateLast" value="<?php echo strtotime("-7 days", $firstDay); ?> " /> <input type="hidden" id="eventDateToday" value="<?php echo mktime(0, 0, 0); ?> " /> <input type="hidden" id="eventDateNext" value="<?php echo strtotime("tomorrow", $lastDay); ?> " /> <ul id="eventButtons"> <li id="icalLi"><a href="ical.php<?php echo $icallink; ?> " title="ical subscription link" id="icalA"><span>ical</span></a> </li> <li><button id="eventLastWeek" type="button" title="previous week" class="smallButtons"><span><<</span></button></li> <li><button id="eventToday" type="button" title="today" class="smallButtons"><span>today</span></button></li> <li><button id="eventNextWeek" type="button" title="next week" class="smallButtons"><span>>></span></button></li> </ul> <table border="0" cellspacing="0" cellpadding="0" width="100%" id="eventsList"><?php foreach ($events as $date => $times) { ?> <tr class="eventDayName" <?php if (mktime(0, 0, 0) === (int) str_replace("d", "", $date)) { echo 'id="today"'; } ?> > <td nowrap="nowrap"><?php echo @strftime("%A", (int) str_replace("d", "", $date)); ?> </td> <td width="100%" align="right"><?php echo @strftime("%b %e %Y", (int) str_replace("d", "", $date)); ?> </td> </tr><?php if (count($times)) { ksort($times); foreach ($times as $time => $timeevents) { foreach ($timeevents as $event) { ?> <tr> <td nowrap="nowrap" valign="top" align="right"><?php echo formatFromSQLTime($event["starttime"]); ?> </td> <td valign="top" ><a href="<?php echo getAddEditFile($this->db, "tbld:a4cdd991-cf0a-916f-1240-49428ea1bdd1") . "?id=" . $event["id"]; ?> &backurl=snapshot.php"><?php echo htmlQuotes($event["subject"]); ?> </a></td> </tr><?php } //endforeach events } //endforeach time } else { ?> <tr> <td class="disabledtext" align="right">no events</td> <td> </td> </tr><?php } // endif } //endforeach day ?> </table><?php }
function generate_summary() { if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } list($month, $day, $year) = explode("/", $post_vars["report_date"]); $report_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); // STEP 1. empty report table for given date print $sql_delete = "delete from m_consult_report_dailyservice where service_date = '$report_date'"; $result_delete = mysql_query($sql_delete); // STEP 2. get all consults for specified report date // records are unique for patient_id and service_date $sql_patient = "select c.patient_id, concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, ". "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, ". "p.patient_gender ". "from m_consult c, m_patient p ". "where c.patient_id = p.patient_id ". "and to_days(c.consult_date) = to_days('$report_date')"; if ($result_patient = mysql_query($sql_patient)) { if (mysql_num_rows($result_patient)) { while ($patient = mysql_fetch_array($result_patient)) { // get family and address if ($family_id = family::get_family_id($patient["patient_id"])) { $patient_address = family::get_family_address($family_id); $barangay_name = family::barangay_name($family_id); } else { $family_id = 0; $patient_address = reminder::get_home_address($patient_id); $barangay_name = reminder::get_barangay($patient_id); } // get chief complaint from notes $complaints = notes::get_complaints($patient["patient_id"], $report_date); // get notes dx list or icd10 list if (!$dx_list = icd10::get_icd10_list($patient["patient_id"], $report_date)) { $dx_list = notes::get_diagnosis_list($patient["patient_id"], $report_date); } // get treatment data from notes $plans = notes::get_plan($patient["patient_id"], $report_date); $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, patient_gender, ". "patient_age, patient_address, patient_bgy, family_id, notes_cc, notes_dx, notes_tx, service_date) ". "values ('".$patient["patient_id"]."', '".$patient["patient_name"]."', ". "'".$patient["patient_gender"]."', '".$patient["patient_age"]."', ". "'$patient_address', '$barangay_name', '$family_id', '$complaints', ". "'$dx_list', '$plans', '$report_date')"; $result_insert = mysql_query($sql_insert); } } } }
} } if (file_exists('../modules/news/class.news.php')) { include '../modules/news/class.news.php'; $news = new news; if (!$module->activated('news') && $initmod) { $news->init_sql(); $news->init_menu(); $news->init_deps(); $news->init_lang(); $news->init_help(); } } if (file_exists('../modules/notes/class.notes.php')) { include '../modules/notes/class.notes.php'; $notes = new notes; if (!$module->activated('notes') && $initmod) { $notes->init_sql(); $notes->init_menu(); $notes->init_deps(); $notes->init_lang(); $notes->init_help(); } } if (file_exists('../modules/notifiable/class.notifiable.php')) { include '../modules/notifiable/class.notifiable.php'; $notifiable = new notifiable; if (!$module->activated('notifiable') && $initmod) { $notifiable->init_sql(); $notifiable->init_menu(); $notifiable->init_deps();
function generate_summary() { if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } list($month, $day, $year) = explode("/", $post_vars["report_date"]); //$report_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); $report_date = $year.'-'.$month.'-'.str_pad($day, 2, "0", STR_PAD_LEFT); list($end_month, $end_day, $end_year) = explode("/", $post_vars["end_report_date"]); //$end_report_date = $end_year."-".str_pad($end_month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); $end_report_date = $end_year.'-'.$end_month.'-'.str_pad($end_day, 2, "0", STR_PAD_LEFT); $_SESSION[report_date] = $report_date; $_SESSION[end_report_date] = $end_report_date; // STEP 1. empty report tables for given date $sql_delete = "delete from m_consult_report_dailyservice where service_date = '$report_date'"; $result_delete = mysql_query($sql_delete); $sql_delete = "delete from m_consult_ccdev_report_dailyservice where service_date = '$report_date'"; $result_delete = mysql_query($sql_delete); $sql_delete = "delete from m_consult_mc_report_dailyservice where service_date = '$report_date'"; $result_delete = mysql_query($sql_delete); // STEP 2. get all consults for specified report date // records are unique for patient_id and service_date /*$sql_patient = "select c.patient_id, c.consult_id, ". "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, ". "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, ". "p.patient_gender ". "from m_consult c, m_patient p ". "where c.patient_id = p.patient_id ". "and to_days(c.consult_date) = to_days('$report_date')"; */ $sql_patient = "select c.patient_id, c.consult_id, ". "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, ". "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, ". "p.patient_gender ". "from m_consult c, m_patient p ". "where c.patient_id = p.patient_id ". "and c.consult_date BETWEEN '$report_date' AND '$end_report_date'"; $result_patient = mysql_query($sql_patient) or die("Cannot query: 305 ".mysql_error()); if ($result_patient) { if (mysql_num_rows($result_patient)) { while ($patient = mysql_fetch_array($result_patient)) { // get family and address if ($family_id = family::get_family_id($patient["patient_id"])) { $patient_address = family::get_family_address($family_id); $barangay_id = family::barangay_id($family_id); } else { $family_id = 0; $barangay_id = 0; $patient_address = reminder::get_home_address($patient_id); //$barangay_name = reminder::get_barangay($patient_id); } // get chief complaint and diagnosis from notes $complaints = notes::get_complaints($patient["patient_id"], $report_date); $diagnosis = notes::get_diagnosis_list($patient["patient_id"], $report_date); $treatment = notes::get_plan($patient["patient_id"], $report_date); //get vaccines $vaccines = $this->get_vaccines($patient["patient_id"], $report_date); $services = $this->get_services($patient["consult_id"], $patient["patient_id"], $report_date); $ptgroup = $this->get_ptgroup($patient["consult_id"], $report_date); $aog = $this->get_aog($patient["patient_id"], $report_date); $visit_seq = healthcenter::get_total_visits($patient["patient_id"]); $philhealth_id = philhealth::get_philhealth_id($patient["patient_id"]); if ($mc_id = mc::registry_record_exists($patient["patient_id"])) { $pp_weeks = mc::get_pp_weeks($mc_id, $patient["consult_id"]); //$visit_sequence = mc::get_ppvisit_sequence($mc_id, $patient["consult_id"]); } if ($complaints != '' || $diagnosis != '' || $treatment != '') { $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, ". "patient_gender, patient_age, patient_address, patient_bgy, family_id, philhealth_id, ". "notes_cc, notes_dx, notes_tx, service_date) values ". "('".$patient["patient_id"]."', '".$patient["patient_name"]."', ". "'".$patient["patient_gender"]."', '".$patient["patient_age"]."', ". "'$patient_address', '$barangay_id', '$family_id', '$philhealth_id', ". "'$complaints', '$diagnosis', '$treatment', '$report_date')"; $result_insert = mysql_query($sql_insert); } if ($vaccines != '' || $services != '') { if ($ptgroup == 'CHILD') { $sql_insert = "insert into m_consult_ccdev_report_dailyservice (patient_id, ". "patient_name, patient_gender, patient_age, patient_address, patient_bgy, ". "family_id, philhealth_id, service_given, vaccine_given, service_date) values ". "('".$patient["patient_id"]."', '".$patient["patient_name"]."', ". "'".$patient["patient_gender"]."', '".$patient["patient_age"]."', ". "'$patient_address', '$barangay_id', '$family_id', '$philhealth_id', ". "'$services', '$vaccines', '$report_date')"; $result_insert = mysql_query($sql_insert); } if ($ptgroup == 'MATERNAL') { $sql_insert = "insert into m_consult_mc_report_dailyservice (patient_id, ". "patient_name, patient_gender, patient_age, aog_weeks, postpartum_weeks, patient_address, ". "patient_bgy, family_id, philhealth_id, visit_sequence, service_given, vaccine_given, ". "service_date) values ". "('".$patient["patient_id"]."', '".$patient["patient_name"]."', ". "'".$patient["patient_gender"]."', '".$patient["patient_age"]."', ". "'$aog', '$pp_weeks', '$patient_address', '$barangay_id', '$family_id', '$philhealth_id', ". "'$visit_seq', '$services', '$vaccines', '$report_date')"; $result_insert = mysql_query($sql_insert); } } } /*$sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ". "'NAME / SEX / AGE', patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ". "philhealth_id 'PHILHEALTH ID', notes_cc 'COMPLAINTS', notes_dx 'DIAGNOSIS', notes_tx 'TREATMENT' ". "from m_consult_report_dailyservice where service_date = '$report_date' order by patient_name "; $pdf = new PDF('L','pt','A4'); $pdf->SetFont('Arial','',12); $pdf->AliasNbPages(); $pdf->connect('localhost','root','kambing','game'); $attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - CONSULTS'); $pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_reg.pdf"); header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY"); //$sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ". // "'NAME / SEX / AGE', patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ". // "philhealth_id 'PHILHEALTH ID', vaccine_given 'VACCINE(S) GIVEN', service_given 'SERVICE(S) GIVEN' " // "from m_consult_ccdev_report_dailyservice where service_date = '$report_date' order by patient_name "; //$pdf = new PDF('L','pt','A4'); //$pdf->SetFont('Arial','',12); //$pdf->AliasNbPages(); //$pdf->connect('localhost','root','kambing','game'); //$attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - CHILD CARE SERVICES'); //$pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_ccdev_reg.pdf"); //header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY"); $sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ". "'NAME / SEX / AGE', aog_weeks 'AOG (wks)', postpartum_weeks 'POSTPARTUM WK', ". "patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ". "philhealth_id 'PHILHEALTH ID', visit_sequence 'VISIT SEQ.', vaccine_given 'VACCINE(S) GIVEN', ". "service_given 'SERVICE(S) GIVEN' ". "from m_consult_mc_report_dailyservice where service_date = '$report_date' order by patient_name "; $pdf = new PDF('L','pt','A4'); $pdf->SetFont('Arial','',12); $pdf->AliasNbPages(); $pdf->connect('localhost','root','kambing','game'); $attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - MATERNAL CARE SERVICES'); $pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_mc_reg.pdf"); header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY"); */ } } //STEP 3. display daily service report print "<br/>"; print "<b>DAILY SERVICE REPORT</b><br/>"; print "REPORT DATE : <b>".$post_vars["report_date"]." to ".$post_vars["end_report_date"]."</b><br/><br/>"; $this->display_consults($report_date,"patient_id",$end_report_date); //pass the report_date and patient_id $this->display_ccdev($report_date); $this->display_mc($report_date); $sql = "select count(distinct(patient_id)) from m_consult where ". "to_days(consult_date) = to_days('$report_date') and patient_id != '0'"; $result = mysql_result(mysql_query($sql),0); print "<br/>"; print "Total No. of Today's Patients : $result"; }