当前位置: 首页>>代码示例>>PHP>>正文


PHP Crud类代码示例

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


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

示例1: authenticate

 function authenticate()
 {
     if (!empty($_POST['username']) && !empty($_POST['password'] != '')) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         // Load the CRUD
         require ROOT . '/justit-php-test/models/crud.php';
         $crud_login = new Crud();
         if ($crud_login->login($username, md5($password))) {
             // Set sessions
             $_SESSION['is_logged_in'] = TRUE;
             // redirect to users
             header('Location: ' . global_url() . 'users');
             die;
         } else {
             echo 'Sorry login details are wrong';
             // Set error return to login page
             $this->index();
         }
     } else {
         // Return back to the login
         $this->error_message = "Please fill out the form";
         $this->index();
     }
 }
开发者ID:acutedeveloper,项目名称:justit-php-test,代码行数:25,代码来源:login.php

示例2: primeiroLogin

 public function primeiroLogin()
 {
     $pL = new Crud();
     $pL->setTabela("users");
     $result = $pL->consultar(array("id", "nome", "email"), "id = {$this->idInserido}");
     $_SESSION['dehbora']['user'] = $result->fetch(PDO::FETCH_ASSOC);
 }
开发者ID:romulo1984,项目名称:dehbora,代码行数:7,代码来源:Usuario.php

示例3: insert

 public function insert()
 {
     $params = Param::params();
     $crud = new Crud();
     $crud->insertQuestion($params);
     $params['q_id'] = $crud->getInsertedId();
     $crud->insertAnswer($params);
     $this->render('index');
 }
开发者ID:b-kaxa,项目名称:perld,代码行数:9,代码来源:crud_controller.php

示例4: actionCreate

 public function actionCreate()
 {
     $model = new Crud();
     $form = new Form('codegen.CrudForm', $model);
     if ($form->submitted() && $model->validate()) {
         Yii::import('codegen.controllers.FormAdminController');
         FormAdminController::generateAndSaveForm($model->class);
         $params = $model->attributes;
         $params['module'] = AppManager::getModelModule($model->class);
         $controllers_path = 'codegen.views.templates.crud.controllers';
         $controllers_files = glob(Yii::getPathOfAlias($controllers_path) . DS . '*');
         foreach ($controllers_files as $controller_file) {
             $file_name = pathinfo($controller_file, PATHINFO_FILENAME);
             $code = $this->renderPartial($controllers_path . '.' . $file_name, $params, true);
             $file_name = $model->class . $file_name . '.php';
             $dir = MODULES_PATH . $params['module'] . DS . 'controllers' . DS;
             if (!is_dir($dir)) {
                 mkdir($dir, 0777, true);
                 chmod($dir, 0777);
             }
             $file_path = $dir . $file_name;
             file_put_contents($file_path, $code);
             chmod($file_path, 0777);
         }
         $views_path = 'codegen.views.templates.crud.views';
         $views_files = glob(Yii::getPathOfAlias($views_path) . DS . '*' . DS . '*');
         foreach ($views_files as $view_file) {
             $view_file = str_replace(Yii::getPathOfAlias($views_path), '', $view_file);
             $file_name = pathinfo($view_file, PATHINFO_BASENAME);
             $file_code = $this->renderPartial($views_path . str_replace(array(DS, '.php'), array('.', ''), $view_file), $params, true);
             $view_file_path = MODULES_PATH . $params['module'] . DS . 'views' . $view_file;
             $view_file_dir = pathinfo($view_file_path, PATHINFO_DIRNAME);
             $child_dir = pathinfo($view_file_dir, PATHINFO_FILENAME);
             if ($child_dir == 'client') {
                 $view_file_dir = str_replace('client', lcfirst($model->class), $view_file_dir);
             } else {
                 if ($child_dir == 'admin') {
                     $view_file_dir = str_replace('admin', lcfirst($model->class) . 'Admin', $view_file_dir);
                 }
             }
             if (!is_dir($view_file_dir)) {
                 mkdir($view_file_dir, 0777, true);
                 chmod($view_file_dir, 0777);
             }
             $file_path = $view_file_dir . DS . $file_name;
             file_put_contents($file_path, $file_code);
             chmod($file_path, 0777);
         }
         $msg = "Добавьте  в метод adminMenu()  в файле " . ucfirst($params['module']) . "Module.php<br/>\r\n                   'Управление {$params['instrumental']}'    => Yii::app()->createUrl('/{$params['module']}/" . lcfirst($params['class']) . "Admin/manage'), <br/>\r\n                   'Создать {$params['accusative']}' => Yii::app()->createUrl(''/{$params['module']}/" . lcfirst($params['class']) . "Admin/create'),";
         Yii::app()->user->setFlash(Controller::MSG_SUCCESS, 'CRUD создан!');
         Yii::app()->user->setFlash(Controller::MSG_INFO, $msg);
         $this->redirect($_SERVER['REQUEST_URI']);
     }
     $this->render('create', array('form' => $form));
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:55,代码来源:CrudAdminController.php

示例5: testCrud

 public function testCrud()
 {
     $c = new Crud();
     $c->addSubject(array('data' => array(array('id' => '123', 'title' => 'shirt', 'images' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png'), 'thumbnails' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png')))));
     $r = $this->engine->upload($c);
     $this->assertEquals($r->status, 200);
     $r = $this->engine->update($c);
     $this->assertEquals($r->status, 200);
     $r = $this->engine->delete($c);
     $this->assertEquals($r->status, 200);
 }
开发者ID:pvwoods,项目名称:merlin-php,代码行数:11,代码来源:CrudTest.php

示例6: Email

 public function Email($codeIgniterDb = null)
 {
     parent::Crud($codeIgniterDb);
     $this->data = array('ID' => '', 'sender' => '', 'receiver' => '', 'subject' => '', 'message' => '', 'error' => '', 'status' => '');
     $this->table = 'emails';
     $this->key = 'ID';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:email.php

示例7: Offer

 public function Offer($codeIgniterDb = null)
 {
     parent::Crud($codeIgniterDb);
     $this->data = array('id' => '', 'question' => '', 'value' => '', 'count' => '');
     $this->table = 'offers';
     $this->key = 'script';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:offer.php

示例8: Activator

 public function Activator($codeIgniterDB = null)
 {
     parent::Crud($codeIgniterDB);
     $this->table = 'activations';
     $this->data = array('email' => '', 'activationKey' => '');
     $this->key = 'activationKey';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:activator.php

示例9: Assessment

 /**
  * Marks relate to scripts on a one-to-one basis, and therefore they share
  * a primary key: the ID field of script, thus script.ID = mark.script
  *
  * @param unknown_type $codeIgniterDb
  * @return Mark
  */
 public function Assessment($codeIgniterDb = null)
 {
     parent::Crud($codeIgniterDb);
     $this->data = array('script' => '', 'marker' => '', 'markData' => '', 'status' => '', 'targets' => '', 'generalComment' => '');
     $this->table = 'assessments';
     $this->key = 'marker';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:14,代码来源:assessment.php

示例10: AssessmentFix

 public function AssessmentFix($codeIgniterDb = null)
 {
     parent::Crud($codeIgniterDb);
     $this->data = array('email' => '', 'hadProblem' => '', 'paid' => '');
     $this->table = 'assessmentFix';
     $this->key = 'email';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:assessmentfix.php

示例11: get

 public function get($field)
 {
     if ($field === 'marks') {
         return unserialize($this->data['marks']);
     }
     return Crud::get($field);
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:contractpayment.php

示例12: Ticket

 public function Ticket($codeIgniterDb = null)
 {
     parent::Crud($codeIgniterDb);
     $this->data = array('ID' => '', 'email' => '', 'subject' => '', 'message' => '');
     $this->table = 'tickets';
     $this->key = 'ID';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:ticket.php

示例13: get

 function get($key)
 {
     if ($key === 'scripts') {
         return unserialize($this->data['scripts']);
     }
     return Crud::get($key);
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:payment.php

示例14: run

 public static function run($obj, $webClass)
 {
     if ($obj instanceof Model) {
         $cmd = isset($_GET['cmd']) ? addslashes($_GET['cmd']) : 'read';
         if ($cmd == "edit") {
             Crud::createForm($obj, $webClass);
             die;
         }
         if ($cmd == "add") {
             //Crud::createForm($obj,$webClass);
             $json = Crud::addPrecon($obj);
             die(json_encode($json));
         }
         if ($cmd == "delete") {
             $json['bool'] = 1;
             $id = isset($_POST['id']) ? addslashes($_POST['id']) : '';
             $json['bool'] = $obj->delete($id);
             die(json_encode($json));
         }
         if ($cmd == "ws") {
             Crud::workWebService($obj, $webClass);
             die;
         }
         Crud::read($obj, $webClass);
     } else {
         die('Crud hanya bisa dipakai dengan object Crud');
     }
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:28,代码来源:Crud.php

示例15: Referral

 function Referral($codeIgniterDB = null)
 {
     parent::Crud($codeIgniterDB);
     $this->data = array('user' => '', 'referee' => '', 'ipRequested' => '', 'paypalRef' => '');
     $this->table = 'referrals';
     $this->key = 'referee';
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:7,代码来源:referral.php


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