Exemplo n.º 1
0
 public function find_customer($id = null)
 {
    APP::import('Model','Customer');
     $this->Customer   =   new Customer();
     $cus = $this->Customer->find('first',array('conditions'=>array('Customer.id'=>$id)));
     return $cus['Customer']['customername'].'('.$cus['Customer']['tag_name'].')';
 }
Exemplo n.º 2
0
 public function checktag_list($group_id=NULL)
 {
     APP::import('Model','Customer');
     $this->Customer  =   new Customer();
     $group_data  =    $this->Customer->find('all',array('conditions'=>array('Customer.customergroup_id'=>$group_id,'Customer.status'=>1)));
     return count($group_data);
 }
Exemplo n.º 3
0
 /**
  * Get singleton
  * @return APP
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 4
0
 /**
  * count shop in folder
  * 
  */
 public function getCountFolder($shop_id)
 {
     APP::import("Model", array("FolderShop"));
     $this->FolderShop = new FolderShop();
     $data = $this->FolderShop->find("count", array("conditions" => array("FolderShop.shop_id" => $shop_id)));
     return $data;
 }
Exemplo n.º 5
0
	public function dashboard_customer_name($module = NULL ,$value = NULL ,$chk_fld = NULL ,$get_fld = NULL )
    {
        APP::import('Model',$module);
        $this->$module   =   new $module();
        $result = $this->$module->find('first',array('conditions'=>array($module.'.'.$chk_fld=>$value)));
        if(!empty($result[$module][$get_fld])) return $result[$module][$get_fld];
    }
Exemplo n.º 6
0
 /**
  * 框架主方法 !!!
  *
  * @return boolean
  */
 public static function run()
 {
     $controller = ForceStringFrom('c');
     //注意POST或GET中c和a变量名称被占用
     $action = ForceStringFrom('a');
     $controller = Iif($controller, $controller, self::$defaultController);
     $action = Iif($action, $action, self::$defaultAction);
     $app_file = "./controllers/" . $controller . ".php";
     if (!is_file($app_file)) {
         self::debug("file[{$app_file}] does not exists.");
         return false;
     } else {
         require_once realpath($app_file);
     }
     $classname = 'c_' . $controller;
     if (!class_exists($classname, false)) {
         self::debug("class[{$classname}] does not exists.");
         return false;
     }
     $path[0] = $controller;
     $path[1] = $action;
     self::$C = new $classname($path);
     //实例化控件类, 设置为APP当前的控件对像
     if (!method_exists(self::$C, $action)) {
         self::debug("method[{$action}] does not exists in class[{$classname}].");
         return false;
     }
     return call_user_func(array(&self::$C, $action), $path);
 }
 /**
  * データベースの接続先情報を取得する
  * 
  * @access private
  * @author sakuragawa
  */
 private function _getDbConnectInfo()
 {
     $dbConfigInfo = array();
     $dbConfig = new DATABASE_CONFIG();
     // 読み込まれているModel分ループ
     foreach ($this->controller->modelNames as $key => $val) {
         APP::import('Model', $this->controller->modelNames[$key]);
         $model = new $this->controller->modelNames[$key]();
         $useDbConfig = $model->useDbConfig;
         if (!isset($dbConfig->{$useDbConfig})) {
             // 定義されてない
             unset($model);
             continue;
         }
         // 接続設定
         $one = $dbConfig->{$useDbConfig};
         // 必要な分のみ取り出し
         $buf['driver'] = $one['driver'];
         $buf['host'] = $one['host'];
         $buf['database'] = $one['database'];
         if (count($dbConfigInfo) != 0) {
             // 初回以外
             if (!in_array($buf, $dbConfigInfo)) {
                 $dbConfigInfo[$useDbConfig] = $buf;
             }
         } else {
             // 初回
             $dbConfigInfo[$useDbConfig] = $buf;
         }
         unset($model);
     }
     return $dbConfigInfo;
 }
Exemplo n.º 8
0
 /**
  * add shop to folder
  * 
  */
 public function rankFolder($conditions, $user_id)
 {
     APP::import("Model", array("User"));
     $this->User = new User();
     $user = $this->User->findById($user_id);
     $folder = $this->find('list', array('conditions' => $conditions, "group by" => "Folder.id", "order" => "FolderUser.modified DESC", 'fields' => array('FolderUser.id', 'FolderUser.id')));
     $rank_folder = array();
     if (!empty($folder)) {
         if (empty($user["User"]["rank_folder"])) {
             $rank_folder = $folder;
         } else {
             $list = explode(",", $user["User"]["rank_folder"]);
             $listRank = array();
             foreach ($list as $val) {
                 if (!empty($folder[$val])) {
                     $listRank[] = $val;
                 }
             }
             $rank_folder = array_merge($listRank, $folder);
             $rank_folder = array_unique($rank_folder);
         }
         $user["User"]["rank_folder"] = implode(",", $rank_folder);
         $this->User->save($user);
     }
     return $rank_folder;
 }
Exemplo n.º 9
0
 public function getlog_approve_sales($salesorder_id=NULL)
 {
     APP::import('Model','Logactivity');
     $this->Logactivity  =   new Logactivity();
     $log_list    =    $this->Logactivity->find('first',array('conditions'=>array('Logactivity.logid'=>$salesorder_id)));
     return $log_list['User']['username'];
 }
Exemplo n.º 10
0
 /**
  * Inicia uma sessão
  * @param string $sessionName
  */
 public function __construct($sessionName, $ProtectedModule = false)
 {
     self::start();
     $this->SessionName = ($ProtectedModule ? (is_string($ProtectedModule) ? $ProtectedModule : APP::getCurrentModule()) . '-' : null) . $sessionName;
     if (!isset($_SESSION[self::$_SESSION_][$this->SessionName])) {
         $_SESSION[self::$_SESSION_][$this->SessionName] = null;
     }
 }
Exemplo n.º 11
0
 function NewAnnex()
 {
     APP::import('Model', 'Annex');
     $this->Annex = new Annex();
     $this->Annex->create();
     $this->Annex->save();
     return $this->Annex->getLastInsertID();
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     xAC::setApiKey(Config::get('arrowsphere-client.' . APP::environment() . '.XAC_APIKEY'));
     xAC::setApiBaseUrl(Config::get('arrowsphere-client.' . APP::environment() . '.XAC_URL'));
     xAC::setApiVersion(Config::get('arrowsphere-client.' . APP::environment() . '.XAC_APIVERSION'));
     xAC::initServices(true);
     return printf("Services list has been refreshed \n");
 }
Exemplo n.º 13
0
 public function recipe()
 {
     $recettes = App::getInstance()->getTable('recette')->show($_GET['id']);
     $categories = App::getInstance()->getTable('categorie')->show($_GET['id']);
     $ingredients = App::getInstance()->getTable('ingredient')->show($_GET['id']);
     $instructions = APP::getInstance()->getTable('recette')->expl($recettes);
     $this->render('posts.recipe', compact('recettes', 'categories', 'ingredients', 'instructions', 'progress'));
 }
Exemplo n.º 14
0
 public function __construct()
 {
     $this->_options['ci'] = $this->ci =& get_instance();
     $this->theme = APP::get_namespace_id() == 'admin' ? false : true;
     if (APP_DIR && is_dir(FCPATH . 'plugins/' . APP_DIR . '/') && $this->ci->controller == 'admin') {
         // 表示插件的后台
         $this->theme = false;
     }
 }
Exemplo n.º 15
0
 public function get_customer_name($customer_id=NULL)
 {
     APP::import('Model','Clientpo');
     $this->Customer  =   new Customer();
     $customer    =    $this->Customer->find('first',array('conditions'=>array('Customer.id'=>$customer_id),'fields'=>array('Customertagname')));
     if(!empty($customer)):
            return  $customer['Customer']['Customertagname'];
         endif;
 }
Exemplo n.º 16
0
 public function dataset()
 {
     $req = APP::request();
     $get = $req->get();
     $search = ZiUtil::is_set('search', $get);
     $query = "nama ILIKE '%" . $search . "%'";
     $results = ZiUtil::search_result_jq_DB($query, $get, 'Principal');
     return ZiUtil::dataset_json($results['query'], $results['total']);
 }
Exemplo n.º 17
0
 public function Add($userId, $text)
 {
     APP::import('Model', 'Log');
     $this->Log = new Log();
     $this->Log->create();
     $this->Log->set('user_id', $userId);
     $this->Log->set('message', $text);
     $this->Log->save();
 }
Exemplo n.º 18
0
 public function dataset()
 {
     $req = APP::request();
     $params = $req->get();
     $search = ZiUtil::is_set('search', $params);
     $query = "uom_nama ILIKE '%" . $search . "%'";
     $results = ZiUtil::search_result_jq_DB($query, $params, 'UOM');
     return ZiUtil::dataset_json($results['query'], $results['total']);
 }
Exemplo n.º 19
0
 /**
  * Init connexion pgsql
  * @throws Exception
  */
 public function __construct()
 {
     try {
         $this->config = APP::getInstance()->config['database'];
         $dsn = "pgsql:host=" . $this->config['server'] . " dbname=" . $this->config['dbname'] . " user="******" password=" . $this->config['password'];
         $this->connexion = new PDO($dsn, $this->config['username'], $this->config['password']);
     } catch (PDOException $e) {
         throw new Exception($e->getMessage());
     }
 }
Exemplo n.º 20
0
 public function blacklistCheck($data)
 {
     $site_url = strtolower($data['site_url']);
     //get restricted list from db
     APP::import("Model", "RestrictedName");
     $this->RestrictedName = new RestrictedName();
     if (!$this->RestrictedName->checkName($site_url)) {
         return false;
     }
     return true;
 }
Exemplo n.º 21
0
 public function main()
 {
     //run daily sales report
     APP::import("Model", "ReportDailySales");
     $this->ReportDailySales = new ReportDailySales();
     $this->ReportDailySales->generateDailySalesReport();
     //run daily order report
     APP::import("Model", "ReportDailyOrders");
     $this->ReportDailyOrders = new ReportDailyOrders();
     $this->ReportDailyOrders->generateDailyOrdersReport();
 }
Exemplo n.º 22
0
 public function initialize()
 {
     //Colors:
     $this->stdout->styles('green', array('text' => 'green'));
     $this->stdout->styles('red', array('text' => 'red'));
     $this->stdout->styles('yellow', array('text' => 'yellow'));
     //Custom layout files
     $this->layout_files = array('fixed' => '' . APP::pluginPath('BootstrapCake') . 'View' . DS . 'Layouts' . DS . 'fixed.ctp', 'fluid' => '' . APP::pluginPath('BootstrapCake') . 'View' . DS . 'Layouts' . DS . 'fluid.ctp');
     //App layout folder:
     $this->layout_folder = '' . APP . 'View' . DS . 'Layouts' . DS;
 }
Exemplo n.º 23
0
 public static function run()
 {
     //项目初始化
     App::init();
     //不过php执行方式不是命令行方式,开启session
     if (!IS_CLI) {
         Session::getInstance()->start(C('SESSION_OPTIONS'));
     }
     //项目执行
     APP::exec();
 }
Exemplo n.º 24
0
 public function checkdepartment_value($user_id=NULL,$department_id=NULL)
 {
     APP::import('Model','UserDepartment');
     $this->UserDepartment  =   new UserDepartment();
     $userdepartment  =    $this->UserDepartment->find('all',array('conditions'=>array('UserDepartment.user_id'=>$user_id,'UserDepartment.department_id'=>$department_id)));
     if(count($userdepartment)>0):
         return TRUE;
         else:
         return FALSE;
     endif;
 }
Exemplo n.º 25
0
 public function GetModelValueCount()
 {
     APP::import('Model', 'Scholar');
     $this->Scholar = new Scholar();
     $this->Scholar->recursive = -1;
     $count = $this->Scholar->find('count', array('conditions' => array('Scholar.scholar_situation =' => '0')));
     if ($count == 0) {
         return "";
     }
     return "<span class='badge badge-danger'>" . $count . "</span>";
 }
Exemplo n.º 26
0
 public function reg_pasien()
 {
     $req = APP::request();
     $params = $req->get();
     $search = ZiUtil::is_set('search', $params);
     $params["sort"] = "cust_usr_nama";
     $params["order"] = "ASC";
     $query = "cust_usr_nama ILIKE '%" . $search . "%' OR cust_usr_kode LIKE '%" . $search . "%'";
     $results = ZiUtil::search_result_DB($query, $params, 'RegPasien');
     return ZiUtil::dataset_json($results['query'], $results['total']);
 }
Exemplo n.º 27
0
 function share($hasp = null)
 {
     $result = array("data" => array(), "error" => 1);
     if (empty($hasp)) {
         $user_id = @$this->request->data['user_id'];
         $folder_id = @$this->request->data['folder_id'];
         $this->user_id = $this->User->getUserIdByAPIToken(@$this->request->data['api_token']);
     } else {
         $secret = explode(self::PREFIX, Security::cipher(base64_decode($hasp), Configure::read('Security.salt')));
         if (count($secret) < 4) {
             return $this->redirect(self::APP_STORE);
         }
         $this->user_id = $secret[0];
         $user_id = $secret[1];
         $folder_id = $secret[2];
     }
     if (empty($user_id) || empty($folder_id) || empty($this->user_id)) {
         if (empty($hasp)) {
             return $this->responseOk($result);
         } else {
             return $this->redirect(self::APP_STORE);
         }
     } else {
         $my_user = $this->User->findById($this->user_id);
         $user = $this->User->findById($user_id);
         $folder = $this->FolderUser->find("first", array("conditions" => array("FolderUser.id" => $folder_id, "FolderUser.user_id" => $this->user_id)));
         if (empty($user) || empty($folder) || empty($my_user)) {
             if (empty($hasp)) {
                 return $this->responseOk($result);
             } else {
                 return $this->redirect(self::APP_STORE);
             }
         }
     }
     if (empty($hasp)) {
         $str = $this->randomString();
         $hasp = $this->safe_b64encode(Security::cipher($this->user_id . self::PREFIX . $user_id . self::PREFIX . $folder_id . self::PREFIX . $str, Configure::read('Security.salt')));
         $link = Router::url('/', true) . "Kaopass/share/{$hasp}";
         $result["error"] = 0;
         $result["data"] = $link;
         return $this->responseOk($result);
     } else {
         APP::import("Model", array("FolderShare"));
         $folderShare = new FolderShare();
         $folderShareData = $folderShare->find("first", array("conditions" => array("FolderShare.folder_id" => $folder_id, "FolderShare.user_id" => $user_id)));
         if ($folderShareData) {
             return $this->redirect(self::APP_KAOPASS);
         }
         $dataSave = array('user_id' => $user_id, "folder_id" => $folder_id);
         $folderShare->create();
         $folderShare->save($dataSave);
         return $this->redirect(self::APP_KAOPASS);
     }
 }
Exemplo n.º 28
0
 public function Show()
 {
     if (!APP::isAjax()) {
         if (!is_file($this->page)) {
             throw new PandaException("View file not found");
         }
         include $this->page;
     } else {
         $this->ShowJSON();
     }
 }
Exemplo n.º 29
0
 function about($params, $renderLayout = true)
 {
     //instantiate db
     $db = new Database();
     //put together call
     $find = array('table' => 'content', 'select' => 'all');
     //return data array
     $content = $db->find($find);
     $pass = array('title_for_page' => 'About', 'data' => $content);
     $path = $this->controller . DS . 'about';
     parent::loadView($path, $pass);
 }
Exemplo n.º 30
0
 private static function config()
 {
     //加载访问应用的配置文件
     $files = tcphp\file::dir_list(CONFIG_PATH, 'php');
     foreach ($files as $key => $config_file) {
         if (is_file($config_file)) {
             C(require $config_file);
         }
     }
     //加载类映射配置
     $a = PHP_PATH . '/' . 'common/' . 'classmaps.php';
     self::$classmaps = (require $a);
 }