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


PHP DAO::save方法代码示例

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


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

示例1: saveNew

 protected function saveNew($user)
 {
     @($dao = new DAO(User));
     $accessLevel = $user->get("usr_accessLevel");
     if (!isset($accessLevel)) {
         $user->set("usr_accessLevel", 1);
     } else {
         if ($accessLevel > 1) {
             if (UserSession::getInstance()->isLogged() !== true) {
                 die("<h1>Die f****** cracker!</h1>");
             } else {
                 if (UserSession::getInstance()->getAccessLevel() < $accessLevel) {
                     die("<h1>Die f****** cracker!</h1>");
                 }
             }
         }
     }
     $user->set("usr_deleted", 0);
     $user->set('usr_confirmationCode', sha1($user->get('usr_id') . $user->get('usr_email') . $user->get('usr_accessLevel')));
     $status = $dao->save($user);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar cadastrar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:25,代码来源:UserBS.php

示例2: saveNew

 protected function saveNew($model)
 {
     @($dao = new DAO(Discipline));
     $model->set('dsc_deleted', 0);
     $status = $dao->save($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar cadastrar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:10,代码来源:DisciplineBS.php

示例3: save

 public function save()
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     $model = new TestProblems();
     $model->setFields($this->params);
     $model->set("tpb_deleted", 0);
     @($dao = new DAO(TestProblems));
     $qbuilder = new QueryBuilder('testproblems');
     $qbuilder->addEqual('tpb_tst_id', $model->get('tpb_tst_id'));
     $qbuilder->addEqual('tpb_prb_id', $model->get('tpb_prb_id'));
     $existent = $dao->findByQuery($qbuilder);
     if (count($existent) < 1) {
         $status = $dao->save($model);
     } else {
         $status = $dao->update($model);
     }
     if ($status !== true) {
         die("Um erro ocorreu ao tentar cadastrar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:23,代码来源:TestProblemsBS.php

示例4: logAction

 public function logAction($user, $test, $msg, $hostname = 'N/A', $question = 'N/A', $score = 'N/A')
 {
     if ($hostname == 'N/A' && isset($_SERVER['REMOTE_HOST'])) {
         $hostname = $_SERVER['REMOTE_HOST'];
     }
     @($dao = new DAO(TestLog));
     $model = new TestLog();
     $today = new DateTime('now');
     $model->set("tsl_time", $today->format(Model::$SQL_DATE_FORMAT));
     $model->set("tsl_usr_id", $user);
     $model->set("tsl_tst_id", $test);
     $model->set("tsl_message", $msg);
     $model->set("tsl_hostname", $hostname);
     $model->set("tsl_remoteAddr", $_SERVER['REMOTE_ADDR']);
     $model->set("tsl_questNumber", $question);
     $model->set("tsl_score", $score);
     $status = $dao->save($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar salvar log, favor contatar um professor:<br />" . $status);
     }
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:21,代码来源:TestBS.php

示例5: saveIfNotExists

 protected function saveIfNotExists($model)
 {
     if (!isset($model)) {
         return false;
     }
     $retrieved = $this->retrieve($model);
     if (isset($retrieved)) {
         return true;
     }
     @($dao = new DAO(TestTrial));
     $today = new DateTime('now');
     $model->set('ttl_lastTrial', $today->format(Model::$SQL_DATE_FORMAT));
     $model->set("ttl_deleted", 0);
     $model->set("ttl_remoteAddr", $_SERVER['REMOTE_ADDR']);
     $model->set("ttl_hostname", "N/A");
     $model->set("ttl_reason", "<i>Nenhuma tentativa realizada ainda.</i>");
     $status = $dao->save($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar iniciar prova, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:22,代码来源:TestTrialBS.php


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