Beispiel #1
0
 public function getPostulantesEvaluacionByVacante($vacante)
 {
     $sql = "select u.id as usuario_id, v.id as vacante_id , et.id as etapa_id, u.nombres, u.apellidos, u.numero_identificacion, v.titulo, et.nombre as etapa, e.valor, e.observacion\n\t\t\t\tfrom vacante as v \n\t\t\t\tinner join postulacion as p on p.vacante_id =  v.id\n\t\t\t\tinner join usuario as u on p.postulante_id =  u.id \n\t\t\t\tinner join evaluacion as e on e.postulacion_id = p.id\n\t\t\t\tinner join etapa as et on et.id = e.etapa_id\n\t\t\twhere v.id = {$vacante} or 999 = {$vacante}\n\t\torder by u.id, v.id, et.id";
     $model = new model();
     $result = $model->runSql($sql);
     return $model->getRows($result);
 }
Beispiel #2
0
 public function deleteCategoria()
 {
     $categoria = $_GET['id'];
     $sql = "delete from categoria where id = " . $categoria;
     $model = new model();
     $result = $model->runSql($sql);
 }
 function validaLogin()
 {
     $email = $_POST['email'];
     $senha = $_POST['senha'];
     echo '1';
     if (!isset($email) || !isset($senha)) {
         sessao_limpa();
     }
     echo '2';
     if (strlen(trim($email)) == 0 || strlen(trim($senha) == 0)) {
         header("Location: /login/error/msg/u_s");
     }
     echo '3';
     $model = new model();
     $query = "SELECT * FROM usuario WHERE email_usuario = '{$email}' AND senha_usuario = '{$senha}'";
     $result = $model->readSQL($query);
     $session = new session();
     if ($result) {
         $session->sessao_grava($result[0]['email_usuario'], $result[0]['id_usuario_tipo']);
         header("Location: /index");
     } else {
         $session->sessao_limpa();
         header("Location: /login/error/msg/u_s");
     }
 }
Beispiel #4
0
Datei: m.php Projekt: xurenlu/tik
 function action_comments_list()
 {
     global $data;
     $comm = new model("comments");
     $data["articles"] = $comm->page("service_id,object_id,id,ip,create_time,author,service_name");
     v();
 }
 public function mostraGrid()
 {
     $total_reg = "10";
     // número de registros por página
     $pagina = $_SESSION['pagina'];
     if (!$pagina) {
         $pc = "1";
     } else {
         $pc = $pagina;
     }
     $inicio = $pc - 1;
     $inicio = $inicio * $total_reg;
     //list all records
     $estado_model = new estadoModel();
     $model = new model();
     $qry_limitada = $estado_model->getEstado('stat<>0', $inicio . ',' . $total_reg);
     //Full table Scan :( or :)
     //send the records to template sytem
     $this->smarty->assign('listestado', $qry_limitada);
     // Total de Registros na tabela
     $qry_total = $model->readSQL("SELECT count(*)as total FROM estado WHERE stat<>0");
     $total_registros = $qry_total[0]['total'];
     //pega o valor
     $html = $this->paginador($pc, $total_registros, 'estado');
     return $html;
 }
Beispiel #6
0
 /**
  * Obtiene Categorias
  */
 public function getCategoriaList()
 {
     $model = new model();
     $sql = "select * from categoria ";
     $result = $model->runSql($sql);
     return $model->getRows($result);
 }
Beispiel #7
0
 public function calculate($address_id)
 {
     $total = 0;
     $model = new model("fare");
     $fare = $model->where("is_default=1")->find();
     if ($fare) {
         $addr = $model->table('address')->where("id={$address_id}")->find();
         if ($addr) {
             $city = $addr['city'];
             $first_price = $fare['first_price'];
             $second_price = $fare['second_price'];
             $first_weight = $fare['first_weight'];
             $second_weight = $fare['second_weight'];
             $zoning = unserialize($fare['zoning']);
             foreach ($zoning as $zon) {
                 if (preg_match(',' . $city . ',', ',' . $zon['area'] . ',') > 0) {
                     $first_price = $zon['f_price'];
                     $second_price = $zon['s_price'];
                     $first_weight = $zon['f_weight'];
                     $second_weight = $zon['s_weight'];
                     break;
                 }
             }
             if ($this->weight <= $first_weight) {
                 $total = $first_price;
             } else {
                 $weight = $this->weight - $first_weight;
                 $total = $first_price + ceil($weight / $second_weight) * $second_price;
             }
         }
     }
     return sprintf("%01.2f", $total);
 }
 function index()
 {
     $dsn = array();
     $this->sv("rooturl", preg_replace('/&t=.*/', '', $_SERVER['REQUEST_URI']));
     if (f('submit')) {
         $dsn['dbHost'] = either(f("host"), "db4free.net");
         $dsn['port'] = either(f("port"), 3306);
         $dsn['dbHost'] .= ":" . $dsn['port'];
         $dsn['dbName'] = either(f("db"), "greedisok");
         $dsn['dbUser'] = either(f("user"), "greedisok");
         $dsn['dbPswd'] = either(f("pass"), 'greedisok');
         $dsn["charset"] = "";
         include_once ROOT . "lib/vip/DBUtil.php";
         $db = new DB($dsn);
         include_once ROOT . "app/main/model.php";
         $modelobj = new model($db);
         $this->sv("dsn", $dsn);
         try {
             $this->sv("table_list", $modelobj->table_names());
             $table = f('t');
             if ($table) {
                 $modelobj->change_table($table);
                 $table_detail = $modelobj->detail();
                 $this->sv("table_detail", $table_detail);
             }
         } catch (Exception $e) {
             $this->sv("info", $e->getMessage());
         }
     }
 }
/**
 * 实例化模型类
 */
function M($table)
{
    static $modelArray = array();
    if (isset($modelArray[$table])) {
        return $modelArray[$table];
    } else {
        if (file_exists(APP_PATH . 'model' . DIRECTORY_SEPARATOR . $table . 'Model.php')) {
            $model = $table . 'Model';
            $model = new $model();
            $modelArray[$table] = $model;
        } else {
            $model = new model();
            //设置表名
            $model->table = $table;
            //获取属性绑定
            $attribute = array();
            $colums = $model->findAllBySql("select COLUMN_NAME from information_schema.columns where table_name='{$model->pre}{$model->table}'");
            foreach ($colums as $val) {
                $attribute[$val['COLUMN_NAME']] = $val['COLUMN_NAME'];
            }
            $model->attributes = $attribute;
            $modelArray[$table] = $model;
        }
        return $model;
    }
}
Beispiel #10
0
 public function deleteArea()
 {
     $area = $_GET['id'];
     $sql = "update area set eliminado = 1 where id = " . $area;
     $model = new model();
     $result = $model->runSql($sql);
 }
Beispiel #11
0
 public function getUsuarioByCedula($cedula)
 {
     $model = new model();
     $sql = "select * from usuario where numero_identificacion = " . $cedula;
     $result = $model->runSql($sql);
     $resultArray = $model->getRows($result);
     return $resultArray[0];
 }
Beispiel #12
0
 public function obtenerUsuario($usuario)
 {
     $model = new model();
     $sql = "Select * from usuario where numero_identificacion = " . $usuario;
     $result = $model->runSql($sql);
     $resultArray = $model->getRows($result);
     return $resultArray[0];
 }
 public function run()
 {
     $m = new AuditTrail();
     $m->unsetAttributes();
     $m->model = get_class($this->model);
     $m->model_id = $this->model->getPrimaryKey();
     $this->renderpartial('history', array('model' => $m, 'id' => $this->id));
 }
function complement_user_profile($user)
{
    include_once "model.php";
    include_once "view.php";
    $model = new model();
    $view = new view();
    $result = $model->get_agencies();
    $view->profile_fields($user, $result);
}
Beispiel #15
0
 public function db()
 {
     jiashu::loadLib('model');
     $user = new model('user', 'testdb');
     //$r = $user->executeSql('select * from test_user');//you can use executeSql() to query a SQL statment directly.用executeSql()函数可以直接执行SQL语句
     $r = $user->field('username,email')->limit('1')->query();
     JSFW()->setTplData('r', $r);
     JSFW()->render('index');
 }
 public function getRandomLessonMsg($num)
 {
     if (isset($num)) {
         $xueyuan = new model("xueyuan", "", "");
         $xueyuanList = $xueyuan->query("SELECT * FROM zhuanyelesson WHERE l_studentxueyuan IN (SELECT xy_name FROM xueyuan)");
     } else {
         return false;
     }
 }
Beispiel #17
0
 function doAction()
 {
     //获取任务开始时间
     $model = new model('seven_set');
     $set = $model->get('*', array('id' => 1));
     $start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
     //检测是否有签到记录
     $data['openid'] = $_SESSION['openid'];
     $data['addtime'] = empty($_POST['date']) ? strtotime(date('Y-m-d')) : $start + 86400 * ($_POST['date'] - 1);
     $is_sign = $this->list->has(array('AND' => $data));
     //检测是否上传图片
     if (empty($_POST["img"])) {
         $this->json('请上传图片', 0);
     }
     $file_path = "static/upload/seven/";
     if (!file_exists($file_path) || !is_writable($file_path)) {
         @mkdir($file_path, 0755, true);
     }
     $img = base64_decode(str_replace('data:image/jpeg;base64,', "", $_POST['img']));
     $src = $file_path . date('Ymdhis') . rand(1000, 9999) . '.jpg';
     file_put_contents($src, $img);
     //旋转图片
     if (!empty($_POST['deg'])) {
         //创建图像资源,以jpeg格式为例
         $source = imagecreatefromjpeg($src);
         //使用imagerotate()函数按指定的角度旋转
         $rotate = imagerotate($source, $_POST['deg'], 0);
         //旋转后的图片保存
         imagejpeg($rotate, $src);
     }
     //写入签到记录
     if ($is_sign) {
         $res = $this->list->update(array('src' => $src), array('AND' => $data));
     } else {
         $data['src'] = $src;
         $res = $this->list->insert($data);
     }
     if (!$res) {
         $this->json('签到失败', 0);
     }
     //增加连续签到天数
     $map['openid'] = $_SESSION['openid'];
     $rs = $this->user->get('*', $map);
     unset($data['src']);
     if (!$rs) {
         //没有记录则新增数据
         $data['total'] = 1;
         $this->user->insert($data);
     } else {
         //有记录则更新数据
         $this->user->update(array('addtime' => $data['addtime'], 'total[+]' => 1), $map);
     }
     $this->json($is_sign ? '修改成功' : '签到成功', 1);
 }
Beispiel #18
0
 /**
  * sync tagger
  *
  * @param  string $key   field
  * @param  model $model eloquent model
  *
  * @return model
  */
 public function eventSyncToTags($key, $model)
 {
     if (!isset(self::$inputData['tag'])) {
         return;
     }
     if (empty(self::$inputData['tag'])) {
         return $model->tags()->detach();
     }
     $data = explode(',', self::$inputData['tag']);
     return $model->tags()->sync($data);
 }
Beispiel #19
0
 /**
  * 
  * @param model $model
  */
 public function setUp($model)
 {
     //echo ' setUp ';
     $properties = $model->___get('_properties');
     //var_dump($properties);
     foreach ($this->_properties as $propertyName => $propertyInfo) {
         $properties[$propertyName] = $propertyInfo;
     }
     $model->___set('_properties', $properties);
     $properties = $model->___get('_properties');
     //var_dump($properties);
 }
Beispiel #20
0
 public function onRun()
 {
     $this->page['postPage'] = $this->property('postPage');
     $this->page['pageParam'] = $this->paramName('pageNumber');
     $this->page['noPostsMessage'] = $this->property('noPostsMessage');
     $this->news = $this->page['news'] = NewsModel::published()->viewNews(['page' => $this->property('pageNumber'), 'perPage' => $this->property('postsPerPage')]);
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->news->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
Beispiel #21
0
 public function init()
 {
     $this->view = false;
     // Views disabled
     $model = new model();
     $model->name = "name";
     $model->size = 321;
     $model->url = "http://example.com";
     $model->save();
     $model2 = model::findFirst(array("where" => "name = 'name'"));
     $model2->name = "New name for old model";
     $model->save();
     return false;
 }
 public function executesql()
 {
     $db = new model();
     $sql = $_POST['sql'];
     $sql = stripslashes($sql);
     $this->assign('sql', $sql);
     $l = $db->query($sql);
     if ($l !== false) {
         $type = 1;
     } else {
         $type = 0;
     }
     $this->assign('type', $type);
     $this->display("exesql");
 }
Beispiel #23
0
 function indexAction()
 {
     //数量
     $model = new model();
     $total['admin'] = $model->table('admin')->count('*');
     $count = $model->table('seven_user')->select('*', array('GROUP' => 'openid'));
     $total['sign'] = count($count);
     $this->assign('total', $total);
     //最新签到
     $map['LIMIT'] = 5;
     $map['ORDER'] = 'addtime desc';
     $list = $model->table('seven_user')->select('*', $map);
     $this->assign('list', $list);
     $this->display();
 }
 function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'default';
     $this->table_name = 'category_priv';
     parent::__construct();
 }
Beispiel #25
0
 public function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'default';
     $this->table_name = 'search';
     parent::__construct();
 }
Beispiel #26
0
 public function sql_query($sql)
 {
     if (!empty($this->db_tablepre)) {
         $sql = str_replace('phpcms_', $this->db_tablepre, $sql);
     }
     return parent::query($sql);
 }
Beispiel #27
0
 /**
  * Construct function.
  * 
  * @access public
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->now = time();
     $this->setSavePath();
     $this->setWebPath();
 }
Beispiel #28
0
 /**
  * The construct function.
  * 
  * @access public
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->setAgent();
     $this->setApiRoot();
     $this->classFile = $this->app->loadClass('zfile');
 }
 function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'default';
     $this->table_name = 'dianping_type';
     parent::__construct();
 }
Beispiel #30
0
 public function __construct($par = null)
 {
     if (is_null($par)) {
         $this->mysql = db::getInstance();
         if (!empty($_POST['test']) && !empty($_POST['check'])) {
             $test_id = (int) $_POST['test'];
             $sum = 0;
             foreach ($_POST['check'] as $ch) {
                 $r = $this->mysql->executeQuery("SELECT `id_set` FROM `set_to_test` WHERE `id_set`=:set_id AND `id_test`=:test_id", array(array(':test_id', $test_id, 'integer'), array(':set_id', (int) $ch, 'integer')));
                 $sum += $r['rows'];
             }
             if ($sum < 1) {
                 foreach ($_POST['check'] as $ch) {
                     $this->mysql->executeQuery("INSERT INTO `set_to_test` (`id_test`, `id_set`) VALUES (:test_id, :set_id)", array(array(':test_id', $test_id, 'integer'), array(':set_id', (int) $ch, 'integer')));
                 }
                 $this->data['alert'] = array('type' => 'success', 'mess' => array('addtotest'));
             } else {
                 $this->data['alert'] = array('type' => 'warning', 'mess' => array('testanyet'));
             }
         }
         parent::__construct('adm_menu_set');
         $r = $this->mysql->executeQuery("SELECT `id_set`, `s_name` FROM `set`");
         while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
             $this->data['set'][] = $row;
         }
         $r = $this->mysql->executeQuery("SELECT `id_test`, `t_test_name` FROM `test`");
         if ($r['rows'] >= 1) {
             while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
                 $this->data['test'][] = $row;
             }
         }
     }
 }