本文整理汇总了PHP中model类的典型用法代码示例。如果您正苦于以下问题:PHP model类的具体用法?PHP model怎么用?PHP model使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: deleteCategoria
public function deleteCategoria()
{
$categoria = $_GET['id'];
$sql = "delete from categoria where id = " . $categoria;
$model = new model();
$result = $model->runSql($sql);
}
示例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");
}
}
示例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();
}
示例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;
}
示例6: getCategoriaList
/**
* Obtiene Categorias
*/
public function getCategoriaList()
{
$model = new model();
$sql = "select * from categoria ";
$result = $model->runSql($sql);
return $model->getRows($result);
}
示例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);
}
示例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());
}
}
}
示例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;
}
}
示例10: deleteArea
public function deleteArea()
{
$area = $_GET['id'];
$sql = "update area set eliminado = 1 where id = " . $area;
$model = new model();
$result = $model->runSql($sql);
}
示例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];
}
示例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];
}
示例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));
}
示例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);
}
示例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');
}