Example #1
1
 /**
  * bool insert(Patient $patient, History $historyP, History $historyF, int $idUser, string $login)
  *
  * Inserts a new deleted patient into the database.
  *
  * @param Patient $patient patient to insert
  * @param History $historyP patient's personal antecedents to insert
  * @param History $historyF patient's family antecedents to insert
  * @param int $idUser key of user that makes deletion
  * @param string $login login session of user that makes deletion
  * @return boolean returns false, if error occurs
  * @access public
  */
 function insert($patient, $historyP, $historyF, $idUser, $login)
 {
     $sql = "INSERT INTO " . $this->_table;
     $sql .= " (id_patient, nif, first_name, surname1, surname2, address, phone_contact, ";
     $sql .= "sex, race, birth_date, birth_place, decease_date, nts, nss, ";
     $sql .= "family_situation, labour_situation, education, insurance_company, ";
     $sql .= "id_member, collegiate_number, birth_growth, growth_sexuality, feed, habits, ";
     $sql .= "peristaltic_conditions, psychological, children_complaint, venereal_disease, ";
     $sql .= "accident_surgical_operation, medicinal_intolerance, mental_illness, ";
     $sql .= "parents_status_health, brothers_status_health, spouse_childs_status_health, ";
     $sql .= "family_illness, create_date, id_user, login) VALUES (";
     $sql .= "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ";
     $sql .= "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ";
     $sql .= "?, ?, ?, ?, NOW(), ?, ?);";
     $params = array($patient->getIdPatient(), urlencode($patient->getNIF()), urlencode($patient->getFirstName()), urlencode($patient->getSurname1()), urlencode($patient->getSurname2()), urlencode($patient->getAddress()), urlencode($patient->getPhone()), $patient->getSex(), urlencode($patient->getRace()), $patient->getBirthDate(), urlencode($patient->getBirthPlace()), $patient->getDeceaseDate(), urlencode($patient->getNTS()), urlencode($patient->getNSS()), urlencode($patient->getFamilySituation()), urlencode($patient->getLabourSituation()), urlencode($patient->getEducation()), urlencode($patient->getInsuranceCompany()), $patient->getIdMember(), urlencode($patient->getCollegiateNumber()), urlencode($historyP->getBirthGrowth()), urlencode($historyP->getGrowthSexuality()), urlencode($historyP->getFeed()), urlencode($historyP->getHabits()), urlencode($historyP->getPeristalticConditions()), urlencode($historyP->getPsychological()), urlencode($historyP->getChildrenComplaint()), urlencode($historyP->getVenerealDisease()), urlencode($historyP->getAccidentSurgicalOperation()), urlencode($historyP->getMedicinalIntolerance()), urlencode($historyP->getMentalIllness()), urlencode($historyF->getParentsStatusHealth()), urlencode($historyF->getBrothersStatusHealth()), urlencode($historyF->getSpouseChildsStatusHealth()), urlencode($historyF->getFamilyIllness()), intval($idUser), urlencode($login));
     return $this->exec($sql, $params);
 }
Example #2
1
 public function action_history()
 {
     $data = array('content' => $this->executeCommand(), 'currentdb' => Request::factory()->getDb(), 'cmd' => Request::factory()->getCmd(), 'dbkeys' => Helper_Info::getCountKeysInDb(), 'history' => History::getLast($_SESSION['login']));
     if (Request::factory()->getAjax()) {
         header('Content-Type: application/json');
         echo json_encode($data);
     } else {
         echo View::factory('layout', $data);
     }
 }
Example #3
0
 public function actionUnban($id)
 {
     $ban_model = $this->loadModel($id);
     if (!Webadmins::checkAccess('bans_unban', $ban_model->admin_nick)) {
         throw new CHttpException(403, "У Вас недостаточно прав");
     }
     $history_model = new History();
     $history_model->unsetAttributes();
     $history_model->player_ip = $ban_model->player_ip;
     $history_model->player_id = $ban_model->player_id;
     $history_model->player_nick = $ban_model->player_nick;
     $history_model->admin_ip = $ban_model->admin_ip;
     $history_model->admin_id = $ban_model->admin_id;
     $history_model->admin_nick = $ban_model->admin_nick;
     $history_model->ban_type = $ban_model->ban_type;
     $history_model->ban_reason = $ban_model->ban_reason;
     $history_model->ban_created = $ban_model->ban_created;
     $history_model->ban_length = $ban_model->ban_length;
     $history_model->server_ip = $ban_model->server_ip;
     $history_model->server_name = $ban_model->server_name;
     $history_model->unban_created = time();
     $history_model->unban_reason = 'Разбанен с сайта';
     $history_model->unban_admin_nick = Yii::app()->user->name;
     if ($history_model->save()) {
         if ($ban_model->delete()) {
             Yii::app()->end('Игрок разбанен');
         }
     }
     Yii::app()->end(CHtml::errorSummary($ban_model));
 }
Example #4
0
 /**
  * Initialize the object with raw data
  *
  * @param $data
  * @return History
  */
 public static function initializeWithRawData($data)
 {
     $item = new History();
     if (isset($data['created_at'])) {
         $item->setCreatedAt(new \DateTime('@' . strtotime($data['created_at'])));
     }
     if (isset($data['message'])) {
         $item->setMessage($data['message']);
     }
     return $item;
 }
Example #5
0
 protected function createHistory()
 {
     $user = $this->getMockBuilder('Application\\UserBundle\\Document\\User')->setMethods(array('getUsernameCanonical', 'getCreatedAt'))->getMock();
     $user->expects($this->once())->method('getUsernameCanonical')->will($this->returnValue('joe'));
     $user->expects($this->once())->method('getCreatedAt')->will($this->returnValue(new \DateTime()));
     $history = new History($user);
     foreach (array(1 => 1200, 2 => 1250, 3 => 1300, 4 => 1250, 5 => 1300, 6 => 1100) as $ts => $elo) {
         $history->addUnknownGame($ts, $elo);
     }
     return $history;
 }
 /**
  * method that checks if the contidion is satisfied
  * for the passed id_user in the passed id_course_instance
  *
  * @param int $id_course_instance
  * @param int $id_user
  * @return boolean true if condition is satisfied
  * @access public
  */
 private function isSatisfied($id_course_instance = null, $id_student = null)
 {
     require_once ROOT_DIR . '/include/history_class.inc.php';
     $history = new History($id_course_instance, $id_student);
     $history->get_visit_time();
     if ($history->total_time > 0) {
         $timeSpentInCourse = intval($history->total_time / 60);
     } else {
         $timeSpentInCourse = 0;
     }
     return $timeSpentInCourse >= $this->_param;
 }
Example #7
0
 static function createFor(HistoricalObjectI $object)
 {
     $data = $object->getDataForHistory();
     if (!is_array($data)) {
         $data = array($data);
     }
     foreach ($data as $historyDataEntry) {
         $history = new History();
         $history->setUserId($historyDataEntry->getUserId());
         $history->setEntityType(get_class($object));
         $history->setData(serialize($historyDataEntry->getData()));
         $history->save();
     }
 }
Example #8
0
 public function testPositioning()
 {
     $other_file = tempnam(sys_get_temp_dir() . 'tmp', 'history');
     $el1 = $this->_history->append($other_file);
     $el2 = $this->_history->append($other_file);
     $el3 = $this->_history->append($other_file);
     $this->assertEquals(3, $this->_history->getCount());
     $this->assertEquals($el3, $this->_history->getFirst());
     $this->assertEquals($el1, $this->_history->getLast());
     $this->assertEquals($el2, $this->_history->getNth(1));
     $this->assertEquals($el1, $this->_history->getNext());
     $this->assertFalse($this->_history->getNext());
     unlink($other_file);
 }
 public function update(array $data, $where)
 {
     //save a snapshot now
     require_once 'History.php';
     $historyTable = new History('trainer');
     //cheezy way to get the id
     $parts = explode('=', $where[0]);
     $pid = trim($parts[1]);
     //link to the last history row
     $personHistoryTable = new History('person');
     $hrow = $personHistoryTable->fetchAll("person_id = {$pid}", "vid DESC", 1);
     $historyTable->insert($this, $hrow->current()->vid);
     $rslt = parent::update($data, $where);
     return $rslt;
 }
 public function getHistoryNews()
 {
     $newspaper_id = Input::get('newspaper', '') != '' ? Input::get('newspaper') : false;
     $tag_id = Input::get('tag', '') != '' ? Input::get('tag') : false;
     $query = History::with('newspaper')->with('tag')->select(DB::raw('MAX(total_day) as total_day'), DB::raw('DATE(date) as sdate'), 'history.id as id', 'history.url as url', 'history.id_newspaper as id_newspaper', 'history.id_tag as id_tag', 'history.final_url as final_url', 'history.title as title', 'history.date as date', 'history.facebook as facebook', 'history.twitter as twitter', 'history.total as total', 'history.googleplus as googleplus', 'history.linkedin as linkedin', 'history.image as image')->groupBy('sdate')->orderBy('date', 'DESC');
     return Response::json($query->get());
 }
Example #11
0
 public function clear()
 {
     $this->autoRender = false;
     if ($this->request->is('post')) {
         return json_encode(History::clear($this->Session));
     }
 }
 private function writeHistory($response, $transactionRequest)
 {
     $id_pedido = (int) $this->module->currentOrder;
     $id_transacao = $response->transactionId;
     $id_status = (int) Configuration::get('PS_OS_BCASH_IN_PROGRESS');
     $status = urldecode($response->descriptionStatus);
     $paymentMethodHelper = new PaymentMethodHelper();
     $pagamento_meio = $paymentMethodHelper->getById(Tools::getValue('payment-method'));
     if (PaymentMethodHelper::isCard($pagamento_meio)) {
         $parcelas = Tools::getValue('card-installment');
     } else {
         $parcelas = 1;
     }
     $history = new History($id_pedido, $id_transacao, $id_status, $status, $pagamento_meio->title, $parcelas);
     $history->write();
 }
Example #13
0
 public static function Roll($chance)
 {
     $coinCode = Input::get('coinCode');
     $betSize = Input::get('betsize');
     $profit = Input::get('profit');
     $payout = Input::get('payout');
     $roll = rand(1, 100);
     if ($roll < $chance) {
         $result = 'Win';
     } else {
         $result = 'Lose';
     }
     $wallet_balance = strtolower($coinCode) . "_wallet_balance";
     if (Auth::user()->{$wallet_balance} >= $betSize) {
         if ($result == 'Win') {
             $balance = Coin::Give($coinCode, $profit);
         } else {
             $balance = Coin::Take($coinCode, $betSize);
         }
         History::Add($betSize, $payout, $profit, $coinCode);
     } else {
         $result = "No Funds";
         $balance = Auth::user()->{$wallet_balance};
     }
     return json_encode(['result' => $result, 'profit' => $balance]);
 }
Example #14
0
function show_GET($w)
{
    list($lotid, $householdid) = $w->pathMatch("lotid", "householdid");
    if (empty($lotid)) {
        $w->error("Need a Lot ID");
    }
    if (empty($householdid)) {
        $w->error("Need a household ID");
    }
    $lot = $w->Bend->getLotForId($lotid);
    if (empty($lot)) {
        $w->error("Lot {$lotid} does not exist");
    }
    $household = $w->Bend->getHouseholdForId($householdid);
    if (empty($household)) {
        $w->error("Household {$householdid} does not exist");
    }
    History::add("Bend Household: " . $household->streetnumber);
    $lotTable = array();
    $lotTable["Household"] = array(array(array("Lot Number", "static", "", $lot->lot_number), array("Occupancy", "static", "", $lot->occupancy)), array(array("Street Number", "static", "", $household->streetnumber), array("Is CHL?", "static", "", $household->is_chl ? "yes" : "no"), array("Is Occupied?", "static", "", $household->is_occupied ? "yes" : "no"), array("Number of Occupants", "static", "", $household->num_occupants)));
    $w->ctx("lot", $lot);
    $w->ctx("table", Html::multiColTable($lotTable));
    $w->ctx("household", $household);
    $w->ctx("currentOccupants", $household->getCurrentOccupants());
    $w->ctx("pastOccupants", $household->getPastOccupants());
}
Example #15
0
 function index()
 {
     $h = new History();
     $events = $h->include_related('user')->order_by('id DESC')->get_iterated();
     foreach ($events as $e) {
         $message = unserialize($e->message);
         if (is_string($message)) {
             $message = $this->messages[$message];
         } else {
             $key = array_shift($message);
             $message = vsprintf($this->messages[$key], $message);
         }
         echo $message . ' by ' . $e->user_username . ' ' . time_ago($e->created_on) . '<br>';
     }
     exit;
 }
Example #16
0
function viewtaskgrouptypes_ALL(Web $w)
{
    $w->Task->navigation($w, "Manage Task Groups");
    History::add("Manage Task Groups");
    $task_groups = $w->Task->getTaskGroups();
    if ($task_groups) {
        usort($task_groups, array("TaskService", "sortbyGroup"));
    }
    // prepare column headings for display
    $line = array(array("Title", "Type", "Description", "Default Assignee"));
    // if task group exists, display title, group type, description, default assignee and button for specific task group info
    if ($task_groups) {
        foreach ($task_groups as $group) {
            $line[] = array(Html::a(WEBROOT . "/task-group/viewmembergroup/" . $group->id, $group->title), $group->getTypeTitle(), $group->description, $group->getDefaultAssigneeName());
        }
    } else {
        // if no groups for this group type, say as much
        $line[] = array("There are no Task Groups Configured. Please create a New Task Group.", "", "", "", "");
    }
    // display list of task groups in the target task group type
    $w->ctx("dashboard", Html::table($line, null, "tablesorter", true));
    // tab: new task group
    // get generic task group permissions
    $arrassign = $w->Task->getTaskGroupPermissions();
    // unset 'ALL' given all can never assign a task
    unset($arrassign[0]);
    // set Is Task Active dropdown
    $is_active = array(array("Yes", "1"), array("No", "0"));
    $grouptypes = $w->Task->getAllTaskGroupTypes();
    // build form to create a new task group within the target group type
    $f = Html::form(array(array("Task Group Attributes", "section"), array("Task Group Type", "select", "task_group_type", null, $grouptypes), array("Title", "text", "title"), array("Who Can Assign", "select", "can_assign", null, $arrassign), array("Who Can View", "select", "can_view", null, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", null, $w->Task->getTaskGroupPermissions()), array("Active", "select", "is_active", null, $is_active), array("", "hidden", "is_deleted", "0"), array("Description", "textarea", "description", null, "26", "6"), array("Default Assignee", "select", "default_assignee_id", null, $w->Auth->getUsers())), $w->localUrl("/task-group/createtaskgroup"), "POST", "Save");
    // display form
    $w->ctx("creategroup", $f);
}
Example #17
0
function list_GET(Web $w)
{
    History::add("List Workhours");
    list($userid, $periodid) = $w->pathMatch("a", "b");
    // get the user
    if (!empty($userid)) {
        $user = $w->Auth->getUser($userid);
    } else {
        $user = $w->Auth->user();
    }
    // calculate total work hours for this period
    $workentries = $w->Bend->getWorkhoursForUser($user, $periodid);
    $total_worked = 0;
    $total_accredited = 0;
    if (!empty($workentries)) {
        foreach ($workentries as $we) {
            $total_worked += $we->hours;
            if ($we->user_id == $we->attributed_user_id) {
                $total_accredited += $we->hours;
            }
        }
    }
    $w->ctx("total_worked", $total_worked);
    $w->ctx("total_accredited", $total_accredited);
    $w->ctx("user", $user);
    $w->ctx("workentries", $workentries);
    $w->ctx("workPeriod", $w->Bend->getWorkPeriodForId($periodid));
    $w->ctx("allWorkPeriods", $w->Bend->getAllWorkPeriods());
}
Example #18
0
function admin_ALL(Web $w)
{
    History::add("Workhours Admin");
    $w->ctx("workperiods", $w->Bend->getAllWorkPeriods());
    $w->ctx("focusgroups", $w->Bend->getTopLevelWorkCategories());
    $w->enqueueStyle(["uri" => "/modules/bend/assets/css/bend.css", "weight" => 500]);
}
 /**
  * Modifies an Issue's Reporter.
  *
  * @param   integer $issue_id The id of the issue.
  * @param   string $fullname The id of the user.
  * @param   boolean $add_history If this should be logged.
  * @return int
  */
 public static function update($issue_id, $email, $add_history = true)
 {
     $email = strtolower(Mail_Helper::getEmailAddress($email));
     $usr_id = User::getUserIDByEmail($email, true);
     // If no valid user found reset to system account
     if (!$usr_id) {
         $usr_id = APP_SYSTEM_USER_ID;
     }
     $sql = 'UPDATE
                 {{%issue}}
             SET
                 iss_usr_id = ?
             WHERE
                 iss_id = ?';
     try {
         DB_Helper::getInstance()->query($sql, array($usr_id, $issue_id));
     } catch (DbException $e) {
         return -1;
     }
     if ($add_history) {
         // TRANSLATORS: %1: email, %2: full name
         $current_usr_id = Auth::getUserID();
         History::add($issue_id, $current_usr_id, 'issue_updated', 'Reporter was changed to {email} by {user}', array('email' => $email, 'user' => User::getFullName($current_usr_id)));
     }
     // Add new user to notification list
     if ($usr_id > 0) {
         Notification::subscribeEmail($usr_id, $issue_id, $email, Notification::getDefaultActions());
     }
     return 1;
 }
Example #20
0
 public function Install()
 {
     Settings::CreateTable();
     History::CreateTable();
     User::CreateTable();
     Coin::CreateTable();
     return Redirect::to('/');
 }
Example #21
0
 public function testGetLength()
 {
     $instance = new History();
     $this->assertEquals(0, $instance->getLength());
     $instance->add('foo');
     $this->assertEquals(1, $instance->getLength());
     $instance->add('bar');
     $this->assertEquals(2, $instance->getLength());
     $instance->clear();
     $this->assertEquals(0, $instance->getLength());
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $log = new Process();
     $log->name = "make-history";
     $log->status = "running";
     $log->save();
     $today = Carbon::today();
     $topToday = array();
     $newspapers = Newspaper::select('id')->get();
     $tags = Tag::select('id')->get();
     foreach ($newspapers as $key => $n) {
         $top = $this->getTopLink($today, $n->id, false);
         if ($top) {
             $topToday[] = $top;
         }
     }
     foreach ($tags as $key => $t) {
         $top = $this->getTopLink($today, false, $t->id);
         if ($top) {
             $topToday[] = $top;
         }
     }
     $topToday = array_unique($topToday);
     //Remove links for today
     History::where('date', '=', $today)->delete();
     //Save history
     foreach ($topToday as $key => $t) {
         $this->info($t->title);
         try {
             $h = new History();
             $h->id_ref = $t->id;
             unset($t->id);
             $h->fill($t->toArray());
             $h->date = $today;
             $h->save();
         } catch (Exception $e) {
         }
     }
     $log->status = "finished";
     $log->save();
 }
Example #23
0
function showperiod_GET(Web $w)
{
    list($id) = $w->pathMatch("a");
    $wp = $w->Bend->getWorkperiodForId($id);
    if (empty($wp)) {
        $w->error("Workperiod does not exist", "/bend-workhours/admin");
    }
    History::add("Work Period: " . formatDate($wp->d_start));
    $w->ctx("workperiod", $wp);
    $w->ctx("categories", $w->Bend->getTopLevelWorkCategories());
    $w->ctx("households", $w->Bend->getAllHouseholds());
}
Example #24
0
 /**
  * PDO query() extend history and callback
  *
  * @param string  $query  SQL sentence
  * @param callable  $callback  callback function binded PDO object
  * @param bool  $noLog  If true, History not add
  * @return object  PDO query object
  */
 public function query($query, $callback = null, $noLog = false)
 {
     if (!$noLog && isset($this->history)) {
         $this->history->set($query);
     }
     $result = parent::query($query);
     if ($callback instanceof \Closure) {
         $callback = $callback->bindTo($result);
         $callback($result);
     }
     return $result;
 }
Example #25
0
 /**
  * Method used to log the changes made against a specific issue.
  *
  * @param integer $iss_id The issue ID
  * @param integer $usr_id The ID of the user.
  * @param integer|string $htt_id The type ID of this history event.
  * @param string $summary The summary of the changes
  * @param array $context parameters used in summary
  */
 public static function add($iss_id, $usr_id, $htt_id, $summary, $context = array())
 {
     if (!is_numeric($htt_id)) {
         $htt_id = History::getTypeID($htt_id);
     }
     $params = array('his_iss_id' => $iss_id, 'his_usr_id' => $usr_id, 'his_created_date' => Date_Helper::getCurrentDateGMT(), 'his_summary' => $summary, 'his_context' => json_encode($context), 'his_htt_id' => $htt_id);
     $stmt = 'INSERT INTO {{%issue_history}} SET ' . DB_Helper::buildSet($params);
     try {
         DB_Helper::getInstance()->query($stmt, $params);
     } catch (DbException $e) {
     }
 }
function writeHistory($orderId, $response)
{
    $novoStatus = array();
    if ($response->transactionStatusId == 7) {
        $novoStatus['id'] = (int) Configuration::get('PS_OS_BCASH_CANCELLED');
        $novoStatus['status'] = 'Cancelada';
    } else {
        $novoStatus['id'] = (int) Configuration::get('PS_OS_BCASH_REFUNDED');
        $novoStatus['status'] = 'Devolvida';
    }
    $result = History::writeNewOrderStatus($orderId, $novoStatus);
}
 public function index()
 {
     if (!Auth::check()) {
         return Redirect::to('/');
     }
     $user = Auth::user();
     if (Scheduler::where('uid', '=', $user->id)->count() > 0) {
         return Redirect::to('/inline');
     }
     $count_matches = History::where('uid', '=', $user->id)->count();
     //return Scheduler::where('uid', '=', $user->id)->count();
     return View::make('sessions.index', ['count' => $count_matches]);
 }
Example #28
0
 public static function forward()
 {
     if (self::is_forward()) {
         $_SESSION['client']['__history_id__']++;
     }
     self::$action = true;
     $data = DB::GetOne('SELECT data FROM history WHERE session_name=%s AND page_id=%d AND client_id=%d', array(self::session_id(), $_SESSION['client']['__history_id__'] - 1, CID));
     //		$data = DB::BlobDecode($data);
     if (GZIP_HISTORY && function_exists('gzuncompress')) {
         $data = gzuncompress($data);
     }
     $_SESSION['client']['__module_vars__'] = unserialize($data);
     location(array());
 }
Example #29
0
 public static function getHistorys($arr)
 {
     if (!$arr) {
         return null;
     }
     foreach ($arr as $value) {
         $historys[] = History::getHistory($value);
     }
     if (isset($historys)) {
         return $historys;
     } else {
         return null;
     }
 }
Example #30
-2
 public function editHistory()
 {
     $id = Input::get('id');
     $history_entry = History::find($id);
     $history_entry->ban = Input::get('ban');
     $history_entry->save();
     return Redirect::to('/history');
 }