Example #1
0
 public function getSettings($module)
 {
     $module = Brightery::SuperInstance()->Database->where('raw_name', $module)->get('modules')->row();
     if (isset($module->settings)) {
         return json_decode($module->settings);
     }
 }
 public function indexAction($id)
 {
     $userInfo = $this->permissions->getUserInformation('user_id');
     $user_id_log = $userInfo->user_id;
     $user = new \modules\users\models\Users();
     $user->user_id = $id;
     $user->_select = "user_id, fullname, email, password, image, gender, birthdate";
     $phones = new \modules\users\models\User_phones();
     $phones->_select = "user_phone_id, phone, user_id , `primary`";
     $phones->user_id = $id;
     $res = $phones->get();
     $user_phone_id = $res[0]->user_phone_id;
     $phones->user_phone_id = $user_phone_id;
     $address = new modules\users\models\User_addresses();
     $address->select = 'user_address_id ,user_id';
     $address->user_id = $id;
     $add = $address->get();
     $patient = $this->Database->query("SELECT users.*, `user_addresses`.`address`, `user_phones`.`phone`" . "FROM `users` " . "LEFT JOIN `user_addresses` ON `user_addresses`.`user_id`=`users`.`user_id`" . "LEFT JOIN `user_phones` ON `user_phones`.`user_id`=`users`.`user_id`" . "WHERE `users`.`user_id`='{$id}'" . "")->row();
     if (!$patient) {
         Brightery::error404();
     }
     $diseases = $this->Database->query("SELECT clinic_patient_diseases.*, `clinic_disease_templates`.`title`" . "FROM `clinic_patient_diseases` " . "JOIN `clinic_disease_templates` ON `clinic_disease_templates`.`clinic_disease_template_id`=`clinic_patient_diseases`.`clinic_disease_template_id`" . "JOIN `users` ON `users`.`user_id`=`clinic_patient_diseases`.`user_id`" . "WHERE `clinic_patient_diseases`.`user_id`='{$id}'" . "")->result();
     $notes = $this->Database->query("SELECT clinic_patients_notes.*, (SELECT fullname FROM users WHERE clinic_doctors.user_id = users.user_id ) as doctor_name" . " FROM clinic_patients_notes " . " LEFT JOIN clinic_doctors ON clinic_doctors.clinic_doctor_id = clinic_patients_notes.clinic_doctor_id " . "WHERE clinic_patients_notes.user_id = '{$id}'")->result();
     $xrays = $this->Database->query("SELECT clinic_xray_negative.*" . " FROM clinic_xray_negative " . "WHERE clinic_xray_negative.user_id = '{$id}'")->result();
     return $this->render('clinic_user_profile/index', ['item' => $user->get(), 'phones' => $res, 'address' => $add, 'patient' => $patient, 'diseases' => $diseases, 'notes' => $notes, 'xrays' => $xrays, 'id' => $id, 'idlog' => $user_id_log]);
 }
 public function detailsAction($id = null)
 {
     $this->permission('index');
     if (!$id) {
         return Brightery::error404();
     }
     $this->language->load("clinic_patients");
     $patient = $this->Database->query("SELECT users.*, `user_addresses`.`address`, `user_phones`.`phone`" . "FROM `users` " . "LEFT JOIN `user_addresses` ON `user_addresses`.`user_id`=`users`.`user_id`" . "LEFT JOIN `user_phones` ON `user_phones`.`user_id`=`users`.`user_id`" . "WHERE `users`.`user_id`='{$id}'" . "")->row();
     if (!$patient) {
         Brightery::error404();
     }
     $phones = new \modules\users\models\User_phones();
     $phones->_select = "user_phone_id, phone, user_id , `primary`";
     $phones->user_id = $id;
     $res = $phones->get();
     $user_phone_id = $res[0]->user_phone_id;
     $phones->user_phone_id = $user_phone_id;
     $address = new modules\users\models\User_addresses();
     $address->select = 'user_address_id ,user_id';
     $address->user_id = $id;
     $add = $address->get();
     $info = $this->Database->query("SELECT clinic_patient_diseases.*, `clinic_disease_templates`.`title`" . "FROM `clinic_patient_diseases` " . "JOIN `clinic_disease_templates` ON `clinic_disease_templates`.`clinic_disease_template_id`=`clinic_patient_diseases`.`clinic_disease_template_id`" . "JOIN `users` ON `users`.`user_id`=`clinic_patient_diseases`.`user_id`" . "WHERE `clinic_patient_diseases`.`user_id`='{$id}'" . "")->result();
     $notes = $this->Database->query("SELECT clinic_patients_notes.*, (SELECT fullname FROM users WHERE clinic_doctors.user_id = users.user_id ) as doctor_name" . " FROM clinic_patients_notes " . " LEFT JOIN clinic_doctors ON clinic_doctors.clinic_doctor_id = clinic_patients_notes.clinic_doctor_id " . "WHERE clinic_patients_notes.user_id = '{$id}'")->result();
     $xrays = $this->Database->query("SELECT clinic_xray_negative.*" . " FROM clinic_xray_negative " . "WHERE clinic_xray_negative.user_id = '{$id}'")->result();
     return $this->render('clinic_patients/details', ['patient' => $patient, 'diseases' => $info, 'phones' => $res, 'address' => $add, 'notes' => $notes, 'xrays' => $xrays, 'id' => $id]);
 }
Example #4
0
 function get()
 {
     // GLOBAL ASSETS
     $interface =& Brightery::SuperInstance()->Twig->interface;
     foreach ($this->config->get('Autoload.assets.' . $interface . '.js') as $js) {
         if (!isset($js['module'])) {
             $js['module'] = 'global';
         }
         $this->add($js['file'], $js['storage'], $js['module'], 'js', 'autoload');
     }
     foreach ($this->config->get('Autoload.assets.' . $interface . '.css') as $css) {
         if (!isset($css['module'])) {
             $css['module'] = 'global';
         }
         $this->add($css['file'], $css['storage'], $css['module'], 'css', 'autoload');
     }
     $output = null;
     foreach (array_merge($this->autoload_css, $this->css) as $link) {
         $output .= "<link rel=\"stylesheet\" href=\"{$link}\" />\n";
     }
     foreach (array_merge($this->autoload_js, $this->js) as $link) {
         $output .= "<script src=\"{$link}\"></script>\n";
     }
     return $output;
 }
Example #5
0
 private function parsing()
 {
     $style_ini = $this->stylePath . '/style.ini';
     if (!file_exists($style_ini)) {
         Brightery::error_message($style_ini . " is missed.");
     }
     $this->styleAssets = parse_ini_file($style_ini, true);
 }
Example #6
0
 /**
  * __get magic
  *
  * return super instance's objects
  *
  * @param string $key
  * @return mixed
  */
 public function __get($key)
 {
     $SI =& Brightery::SuperInstance();
     if (isset($SI->{ucfirst($key)})) {
         return $SI->{ucfirst($key)};
     } elseif (isset($this->attributes[$key])) {
         return $this->attributes[$key];
     }
 }
 public function addAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $this->cart->add($id);
     return json_encode(['total' => $this->cart->getItemsCount()]);
 }
Example #8
0
 static function url()
 {
     $url = func_get_args();
     if (is_array($url) && count($url)) {
         $url = implode('/', $url);
     } else {
         $url = null;
     }
     return BASE_URL . Brightery::SuperInstance()->Language->getDefaultLanguage() . "/" . $url;
 }
 public function portfolio_itemAction($seo = null)
 {
     if (!$seo) {
         return Brightery::error404();
     }
     $portfolio_item = new \modules\portfolio\models\Portfolio();
     $portfolio_item->seo = $seo;
     print_r($portfolio_item->get());
     return $this->render('portfolio_item', ['item' => $portfolio_item->get()]);
 }
 public function addAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $userInfo = $this->permissions->getUserInformation();
     $this->database->insert('commerce_wishlist', ['commerce_product_id' => $id, 'user_id' => $userInfo->user_id]);
     return json_encode(['sucess' => 1]);
 }
 public function get_layoutsAction($interface = false, $style = false)
 {
     if (!$interface || !$style) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $model = new \modules\settings\models\Settings();
     foreach ($model->getAvailableLayouts($interface, $style) as $key => $value) {
         echo "<option value=\"{$key}\">" . $value . "</option>";
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $commerce_payment_method = new \modules\commerce\models\Commerce_payment_method();
     $commerce_payment_method->commerce_payment_method_id = $id;
     if ($commerce_payment_method->delete()) {
         Uri_helper::redirect("management/commerce_payment_method");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $xrays = new \modules\clinic\models\Clinic_xray_negative();
     $xrays->clinic_xray_negative_id = $id;
     if ($sid = $xrays->delete()) {
         return json_encode(['sucess' => 1]);
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $notes = new \modules\clinic\models\Clinic_patients_notes();
     $notes->clinic_patient_note_id = $id;
     if ($sid = $notes->delete()) {
         return json_encode(['sucess' => 1]);
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404("The page you requested is not found.");
     }
     $model = new \modules\pm\models\Pm_priorities();
     $model->pm_priority_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/pm_priorities");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $commerce_product_attributes = new \modules\commerce\models\Commerce_product_attributes();
     $commerce_product_attributes->commerce_product_attribute_id = $id;
     if ($commerce_product_attributes->delete()) {
         Uri_helper::redirect("management/commerce_product_attributes");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\clinic\models\Clinic_doctor_reviews();
     $model->clinic_doctor_review_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/clinic_doctor_reviews");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $classfied = new \modules\classfied\models\Classfied_currencies();
     $classfied->classfied_currency_id = $id;
     if ($classfied->delete()) {
         Uri_helper::redirect("management/classfied_currencies");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\pages\models\Pages();
     $model->page_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/pages");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $pm_issue_statues = new \modules\pm\models\Pm_issue_statues();
     $pm_issue_statues->pm_issue_statues_id = $id;
     if ($pm_issue_statues->delete()) {
         Uri_helper::redirect("management/pm_issue_statues");
     }
 }
Example #21
0
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $this->model_instance->{$this->model_instance->getPrimaryKey()} = $id;
     if (!$this->model_instance->get()) {
         return Brightery::error404();
     }
     if ($this->model_instance->delete()) {
         Uri_helper::redirect("management/" . $this->_controller);
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404("The page you requested is not found.");
     }
     $model = new \modules\pm\models\Pm_roles();
     $model->pm_role_id = $id;
     if ($sid = $model->delete()) {
         return json_encode(['sucess' => 1]);
     }
     //        if ($model->delete())
     //            Uri_helper::redirect("management/pm_roles");
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\usergroups\models\Usergroups();
     $model_user_group = new \modules\usergroups\models\Usergroup_zones();
     $model->usergroup_id = $id;
     $model_user_group->usergroup_id = $id;
     if ($model_user_group->delete() && $model->delete()) {
         Uri_helper::redirect("management/usergroups");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\classfied\models\Classfied_cities();
     $model->classfied_city_id = $id;
     $city = $model->get();
     $model->classfied_country_id = $city->classfied_country_id;
     if ($model->delete()) {
         Uri_helper::redirect("management/classfied_cities/index/{$city->classfied_country_id}");
     }
 }
 public function indexAction($page = null)
 {
     if (!$page) {
         Brightery::error404();
     }
     $model = new \modules\pages\models\Pages();
     $model->language_id = $this->language->getDefaultLanguage();
     $model->seo = $page;
     $res = $model->get();
     if (!$res) {
         Brightery::error404();
     }
     return $this->render('pages/index', ['item' => $res]);
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     $this->layout = 'ajax';
     if (!$id) {
         return Brightery::error404("The page you requested is not found.");
     }
     $model = new \modules\pm\models\pm_comments();
     $model->pm_comment_id = $id;
     if ($model->delete()) {
         return json_encode(['status' => 'success']);
     } else {
         return json_encode(['status' => 'faild']);
     }
 }
 public function __construct()
 {
     parent::__construct();
     if (Brightery::SuperInstance()->Config->get('Config.elite_session')) {
         $this->Input->eliteSession();
     }
     // CONFIGURATIONS
     foreach ($this->database->query("SELECT * FROM `settings`")->result() as $setting) {
         if ($setting->key == 'timezone') {
             date_default_timezone_set($setting->value);
         } else {
             Brightery::SuperInstance()->Config->set($setting->key, $setting->value);
         }
     }
     $doc = new ReflectionClass($this);
     $docs = [];
     preg_match_all("/@([a-zA-Z]+) ([a-zA-Z0-9_\\/.\\- ]+)/", $doc->getDocComment(), $res, PREG_SET_ORDER);
     for ($i = 0; $i < count($res); $i++) {
         $docs[$res[$i][1]] = $res[$i][2];
     }
     if (isset($docs['module'])) {
         $this->_module = $docs['module'];
     }
     if (isset($docs['version'])) {
         $this->version = $docs['version'];
     }
     if (isset($docs['interface'])) {
         $this->interface = $docs['interface'];
     }
     if (isset($docs['module'])) {
         $this->_module = $docs['module'];
     }
     if (isset($docs['controller'])) {
         $this->_controller = $docs['controller'];
     }
     Brightery::$RunningModule = $this->_module;
     $this->layoutParams['languages'] = $this->database->query("SELECT * FROM `languages`")->result();
     //        if($user = $this->permissions->getUserInformation())
     //        $this->layoutParams['notifications'] = $this->database->query("SELECT * FROM `notifications` WHERE user_id = '$user->user_id'")->result();
     if (function_exists($this->_module)) {
         $this->_data = call_user_func($this->_module);
     }
     //        if($this->_module == 'commerce'){
     //            $cat_model = new \modules\commerce\models\Commerce_categories();
     //            $this->load->library('cart');
     //            $this->_data = array('categories' => $cat_model->tree(), 'cart' => $this->cart);
     //        }
 }
Example #28
0
 /**
  * Handles uncaught PHP exceptions.
  *
  * This method is implemented as a PHP exception handler.
  *
  * @param \Exception $exception the exception that is not caught
  */
 public function handleException($exception)
 {
     if ($exception instanceof ExitException) {
         print_r($exception);
         return;
     }
     // disable error capturing to avoid recursive errors while handling exceptions
     $this->unregister();
     if ($exception instanceof PDOException) {
         $last_query = null;
         if (method_exists(Brightery::SuperInstance()->Database, 'getLastQuery')) {
             $last_query = Brightery::SuperInstance()->Database->getLastQuery();
         }
         Brightery::loadFile([ROOT, 'styles', 'system', 'database_error.php'], false, ['exception' => $exception, 'last_query' => $last_query]);
     } else {
         //            print_r($exception);
         Brightery::loadFile([ROOT, 'styles', 'system', 'exceptions.php'], false, ['exception' => $exception]);
     }
     $this->exception = $exception;
     print_r($exception);
     exit(500);
     //        try {
     //            $this->logException($exception);
     //            if ($this->discardExistingOutput) {
     //                $this->clearOutput();
     //            }
     //            $this->renderException($exception);
     //            if (!YII_ENV_TEST) {
     //                exit(1);
     //            }
     //        } catch (\Exception $e) {
     //            // an other exception could be thrown while displaying the exception
     //            $msg = (string) $e;
     //            $msg .= "\nPrevious exception:\n";
     //            $msg .= (string) $exception;
     //            if (YII_DEBUG) {
     //                if (PHP_SAPI === 'cli') {
     //                    echo $msg . "\n";
     //                } else {
     //                    echo '<pre>' . htmlspecialchars($msg, ENT_QUOTES, Yii::$app->charset) . '</pre>';
     //                }
     //            }
     //            $msg .= "\n\$_SERVER = " . var_dump($_SERVER);
     //            error_log($msg);
     //            exit(1);
     //        }
     $this->exception = null;
 }
Example #29
0
 public function __construct()
 {
     Log::set('Initialize Path class');
     $this->stdin();
     $this->path['self'] = pathinfo(__FILE__, PATHINFO_BASENAME);
     $this->path['styles'] = Brightery::pathBuilder([ROOT, 'styles']);
     $this->path['source'] = Brightery::pathBuilder([ROOT, 'source']);
     $this->path['system'] = Brightery::pathBuilder([$this->path['source'], SYSTEM_FOLDER]);
     $this->path['cdn'] = Brightery::pathBuilder([ROOT, 'cdn']);
     $this->path['application'] = Brightery::pathBuilder([$this->path['source'], 'app']);
     $this->path['controllers'] = Brightery::pathBuilder([$this->path['application'], 'controllers']);
     $this->path['models'] = Brightery::pathBuilder([$this->path['application'], 'models']);
     $this->path['helpers'] = Brightery::pathBuilder([$this->path['application'], 'helpers']);
     $this->path['system_helpers'] = Brightery::pathBuilder([$this->path['system'], 'helpers']);
     $this->path['libraries'] = Brightery::pathBuilder([$this->path['application'], 'libraries']);
     $this->pathConstants();
 }
Example #30
0
 function eliteSession()
 {
     $userInfo = Brightery::SuperInstance()->permissions->getUserInformation();
     if ($session_id = $this->cookie('session_id')) {
         if ($row = Brightery::SuperInstance()->Database->query("SELECT * FROM `sessions` WHERE `session_id`='{$session_id}'")->row()) {
             Brightery::SuperInstance()->Database->where('session_id', $session_id)->update("sessions", ['latest_activity' => date('Y-m-d H:i:s'), 'user_id' => $userInfo->user_id]);
             session_id($session_id);
             return $row;
         }
     } else {
         $session_id = session_id();
         $this->cookie('session_id', $session_id);
         Brightery::SuperInstance()->Database->insert('sessions', ['session_id' => $session_id, 'user_id' => $userInfo->user_id, 'ip' => $_SERVER['REMOTE_ADDR'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'latest_activity' => date('Y-m-d H:i:s')]);
         if ($row = Brightery::SuperInstance()->Database->query("SELECT * FROM `sessions` WHERE `session_id`='{$session_id}' ")->row()) {
             return $row;
         }
     }
 }