public function dashboard() { $manager = Manager::all(); $avg = array(); foreach ($manager as $key => $man) { $avg[$key] = DB::select('SELECT AVG(percentage) as avg FROM (SELECT (SUM(t.access)/(count(*))*100) as percentage, a.id as aid,t.tool_name, a.manager_id as mid,a.account_name as aname,m.manager as Manager FROM accounts a JOIN managers m ON(m.id = a.manager_id) JOIN tools t ON(t.acc_id = a.id) where m.id = ' . $manager[$key]->id . ' group by (t.acc_id)) as mavg'); } $colors = array('0' => 'primary', '1' => 'red', '2' => 'green', '3' => 'yellow'); return View::make('admin._main', compact('manager', 'colors', 'avg')); }
public static function intercept($path, $type = 'file', $debug = false) { $modules = Manager::all(); foreach ($modules as $module) { $m_path = $module->path(); if (false !== strpos($path, ptc_path('root') . '/app/config')) { continue; // do nothing } else { if (false !== strpos($path, ptc_path('root') . '/app') && false === strpos($path, $m_path)) { $file = str_replace(ptc_path('root') . '/app', $m_path, $path); if ('realpath' === $type && ($f = realpath($file))) { $path = $f; break; // load the first file found } else { if ('file' === $type && file_exists($file)) { if ($debug) { ptc_log([$file, $path], 'StreamWrapper intercepted module file!', 'StreamWrapper Config'); } $path = $file; break; // load the first file found } } } } } return $path; }
protected function session() { $session = Registry::get("session"); $managers = Manager::all(array("user_id = ?" => $this->user->id)); if ($managers) { $session->set("managing", $managers); $this->redirect("/admin"); } $member = Member::first(array("user_id = ?" => $this->user->id)); $doc = Doc::first(array("user_id = ?" => $this->user->id)); if ($member && !$doc) { $organization = Organization::first(array("id = ?" => $member->organization_id)); $session->set("member", $member); $session->set("organization", $organization); $this->redirect("/vendor"); } if ($doc && $member) { $organization = Organization::first(array("id = ?" => $member->organization_id)); $session->set("member", $member); $session->set("organization", $organization); $session->set("doctor", $doc); $this->redirect("/doctor"); } $checkout = isset($_COOKIE["__hlCheckout"]) ? true : false; if ($checkout) { setcookie("__hlCheckout", "", time() - 3600); $this->redirect("/cart/checkout"); } $this->redirect("/patient.html"); }