• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中model的典型用法代码示例。如果您正苦于以下问题:PHP model类的具体用法?PHP model怎么用?PHP model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getPostulantesEvaluacionByVacante

 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);
 }
开发者ID:efaby,项目名称:postulacion,代码行数:7,代码来源:ReporteModel.php


示例2: deleteCategoria

 public function deleteCategoria()
 {
     $categoria = $_GET['id'];
     $sql = "delete from categoria where id = " . $categoria;
     $model = new model();
     $result = $model->runSql($sql);
 }
开发者ID:efaby,项目名称:postulacion,代码行数:7,代码来源:CategoriaModel.php


示例3: validaLogin

 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");
     }
 }
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:25,代码来源:loginController.php


示例4: action_comments_list

 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();
 }
开发者ID:xurenlu,项目名称:tik,代码行数:7,代码来源:m.php


示例5: mostraGrid

 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;
 }
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:26,代码来源:estadoController.php


示例6: getCategoriaList

 /**
  * Obtiene Categorias
  */
 public function getCategoriaList()
 {
     $model = new model();
     $sql = "select * from categoria ";
     $result = $model->runSql($sql);
     return $model->getRows($result);
 }
开发者ID:efaby,项目名称:postulacion,代码行数:10,代码来源:PreguntaModel.php


示例7: calculate

 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);
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:33,代码来源:Fare.php


示例8: index

 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());
         }
     }
 }
开发者ID:tranngocthang89,项目名称:basephpmvc,代码行数:30,代码来源:code_controller.php


示例9: M

/**
 * 实例化模型类
 */
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;
    }
}
开发者ID:jeremywong1992,项目名称:companyBook,代码行数:29,代码来源:function.inc.php


示例10: deleteArea

 public function deleteArea()
 {
     $area = $_GET['id'];
     $sql = "update area set eliminado = 1 where id = " . $area;
     $model = new model();
     $result = $model->runSql($sql);
 }
开发者ID:efaby,项目名称:postulacion,代码行数:7,代码来源:AreaModel.php


示例11: getUsuarioByCedula

 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];
 }
开发者ID:efaby,项目名称:postulacion,代码行数:8,代码来源:UsuarioModel.php


示例12: obtenerUsuario

 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];
 }
开发者ID:efaby,项目名称:postulacion,代码行数:8,代码来源:RegistroModel.php


示例13: run

 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));
 }
开发者ID:dbrisinajumi,项目名称:audittrail,代码行数:8,代码来源:AudittrailHistory.php


示例14: complement_user_profile

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);
}
开发者ID:rdelr011,项目名称:BOLO-Flier-Creator,代码行数:9,代码来源:extra-user-data.php


示例15: db

 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');
 }
开发者ID:gusen,项目名称:jiashu,代码行数:9,代码来源:index.php


示例16: getRandomLessonMsg

 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;
     }
 }
开发者ID:hebkia,项目名称:graduation-project,代码行数:9,代码来源:UtilDataModel.class.php


示例17: doAction

 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);
 }
开发者ID:eyblog,项目名称:mvc,代码行数:54,代码来源:sevenController.class.php


示例18: eventSyncToTags

 /**
  * 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);
 }
开发者ID:sharenjoy,项目名称:axes,代码行数:19,代码来源:TaggableTrait.php


示例19: setUp

 /**
  * 
  * @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);
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:16,代码来源:modelBehavior.php


示例20: init

 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;
 }
开发者ID:WanSpi,项目名称:wcms,代码行数:14,代码来源:model.php



注:本文中的model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP model_cache类代码示例发布时间:2022-05-23
下一篇:
PHP mod_quiz_display_options类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap