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

PHP Crud类代码示例

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

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



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


示例16: page

 public function page()
 {
     //create the model object
     $cal = new Page();
     //send the webclass
     $webClass = __CLASS__;
     //by pass the form
     $cmd = isset($_GET['cmd']) ? addslashes($_GET['cmd']) : 'read';
     if ($cmd == "edit") {
         //Crud::createForm($obj,$webClass);
         //die('edit');
         $id = isset($_GET['id']) ? addslashes($_GET['id']) : 0;
         if ($id) {
             $cal->getByID($id);
         }
         $mps['id'] = $id;
         $mps['obj'] = $cal;
         Mold::plugin("Page", "pageForm", $mps);
         exit;
     }
     $cid = addslashes($_GET['cid']);
     if ($cid != "") {
         $_SESSION['pageConID'] = $cid;
     } else {
         //unset($_SESSION['pageConID']);
     }
     $cal->read_filter_array = array("post_gallery_id" => $_SESSION['pageConID']);
     //echo $cid;
     //pr($cal);
     //run the crud utility
     Crud::run($cal, $webClass);
     //pr($mps);
 }
开发者ID:CapsuleCorpIndonesia,项目名称:elang-combo,代码行数:33,代码来源:Page2ContainerWeb.php


示例17: tambah

 function tambah()
 {
     $acc = new SiteMember();
     $_SESSION['sementara']['admin_email'] = $_POST['admin_email'];
     $_SESSION['sementara']['admin_password'] = $_POST['admin_password'];
     $_SESSION['sementara']['firsttime'] = 1;
     Crud::AddManual($acc);
 }
开发者ID:CapsuleCorpIndonesia,项目名称:biji_katak,代码行数:8,代码来源:WebAppsMain.php


示例18: qRRequestModel

 public function qRRequestModel()
 {
     //create the model object
     $cal = new QRRequestModel();
     $webClass = __CLASS__;
     //run the crud utility
     Crud::run($cal, $webClass);
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:8,代码来源:QRRequest.php


示例19: MTranDetail

 function MTranDetail()
 {
     $cal = new MTranDetail();
     //        $cal->printColumlistAsAttributes();
     //send the webclass
     $webClass = __CLASS__;
     Crud::run($cal, $webClass);
 }
开发者ID:CapsuleCorpIndonesia,项目名称:es-teler-baru-suka,代码行数:8,代码来源:Msales.php


示例20: crud

 public function crud($model)
 {
     if (!isset($_GET['id'])) {
         $this->template->content = Crud::table($model, $this->db);
     } else {
         $this->template->content = Crud::form($model, $this->db, (int) $_GET['id']);
     }
 }
开发者ID:nemis,项目名称:Fm,代码行数:8,代码来源:index.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP CrugeTranslator类代码示例发布时间:2022-05-23
下一篇:
PHP CrowdfundingHelperRoute类代码示例发布时间: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