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


PHP DAO::update方法代码示例

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


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

示例1: update

 public function update()
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     $model = new TestProblems();
     $model->setFields($this->params);
     @($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) {
         die("<h1>Problema inválida.</h1>");
     }
     $existent = $existent[0];
     if (!isset($existent)) {
         die("<h1>Problema não existe.</h1>");
     }
     $status = $dao->update($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar atualizar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:25,代码来源:TestProblemsBS.php

示例2: restoreTables

 /**
  * Restore the given tables.
  * @param $tables array
  * @param $test PHPUnit_Framework_Assert
  */
 public static function restoreTables($tables, $test)
 {
     $dao = new DAO();
     foreach ($tables as $table) {
         $sqls = array("TRUNCATE TABLE {$table}", "INSERT INTO {$table} SELECT * FROM backup_{$table}", "DROP TABLE backup_{$table}");
         foreach ($sqls as $sql) {
             if (!$dao->update($sql, false, true, false)) {
                 $test->fail("Error while restoring {$table}: offending SQL is '{$sql}'");
             }
         }
     }
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:17,代码来源:PKPTestHelper.inc.php

示例3: update

 protected function update($model)
 {
     @($dao = new DAO(Problem));
     $qbuilder = new QueryBuilder('problem');
     $qbuilder->addEqual('prb_id', $model->get('prb_id'));
     $existent = $dao->findByQuery($qbuilder);
     if (count($existent) != 1) {
         die("<h1>Problema inválida.</h1>");
     }
     $existent = $existent[0];
     if (!isset($existent)) {
         die("<h1>Problema não existe.</h1>");
     }
     $status = $dao->update($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar atualizar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:19,代码来源:ProblemBS.php

示例4: update

 protected function update($model)
 {
     @($dao = new DAO(Discipline));
     $qbuilder = new QueryBuilder('discipline');
     $qbuilder->addEqual('dsc_id', $model->get('dsc_id'));
     $existent = $dao->findByQuery($qbuilder);
     if (count($existent) != 1) {
         die("<h1>Disciplina inválida.</h1>");
     }
     $existent = $existent[0];
     if (!isset($existent)) {
         die("<h1>Disciplina não existe.</h1>");
     }
     if ($existent->get('dsc_usr_id') != UserSession::getInstance()->getUser()->get("usr_id")) {
         if (UserSession::getInstance()->getAccessLevel() < 6) {
             die("<h1>Forbidden resource for you.</h1>");
         }
     }
     $status = $dao->update($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar atualizar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:24,代码来源:DisciplineBS.php

示例5: dirname

distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
require_once dirname(__FILE__) . "/BitID.php";
require_once dirname(__FILE__) . "/DAO.php";
$bitid = new BitID();
$dao = new DAO();
$variables = $_POST;
$post_data = json_decode(file_get_contents('php://input'), true);
// SIGNED VIA PHONE WALLET (data is send as payload)
if ($post_data !== null) {
    $variables = $post_data;
}
// ALL THOSE VARIABLES HAVE TO BE SANITIZED !
$signValid = $bitid->isMessageSignatureValidSafe(@$variables['address'], @$variables['signature'], @$variables['uri'], true);
$nonce = $bitid->extractNonce($variables['uri']);
if ($signValid && $dao->checkNonce($nonce) && $bitid->buildURI(SERVER_URL . 'callback.php', $nonce) === $variables['uri']) {
    $dao->update($nonce, $variables['address']);
    // SIGNED VIA PHONE WALLET (data is send as payload)
    if ($post_data !== null) {
        //DO NOTHING
    } else {
        // SIGNED MANUALLY (data is stored in $_POST+$_REQUEST vs payload)
        // SHOW SOMETHING PRETTY TO THE USER
        session_start();
        $_SESSION['user_id'] = $variables['address'];
        header("Location: user.php");
    }
}
开发者ID:godJah,项目名称:bitid-php,代码行数:31,代码来源:callback.php

示例6: update

 protected function update($model)
 {
     @($dao = new DAO(Test));
     $model->set("tst_password", sha1($model->get("tst_password")));
     $model->set("tst_visibleSince", Model::parseInputToSQLDate($model->get("tst_visibleSince")));
     $model->set("tst_visibleUntil", Model::parseInputToSQLDate($model->get("tst_visibleUntil")));
     $model->set("tst_openSince", Model::parseInputToSQLDate($model->get("tst_openSince")));
     $model->set("tst_openUntil", Model::parseInputToSQLDate($model->get("tst_openUntil")));
     $qbuilder = new QueryBuilder('test');
     $qbuilder->addEqual('tst_id', $model->get('tst_id'));
     $existent = $dao->findByQuery($qbuilder);
     if (count($existent) != 1) {
         die("<h1>Prova inválida.</h1>");
     }
     $existent = $existent[0];
     if (!isset($existent)) {
         die("<h1>Prova não existe.</h1>");
     }
     $status = $dao->update($model);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar atualizar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:24,代码来源:TestBS.php

示例7: save

 public function save()
 {
     if (UserSession::getInstance()->isLogged() !== true) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     $model = new TestTrial();
     $model->setFields($this->params);
     $model->set('ttl_usr_id', UserSession::getInstance()->getUser()->get('usr_id'));
     $existent = $this->retrieve($model);
     $tproblemBS = new TestProblemsBS(null);
     $qbuilder = new QueryBuilder("testproblems");
     $qbuilder->addEqual("tpb_prb_id", $existent->get("ttl_prb_id"));
     $qbuilder->addEqual("tpb_tst_id", $existent->get("ttl_tst_id"));
     $tprobs = $tproblemBS->findNotDeleted($qbuilder);
     if (count($tprobs) < 1) {
         die("Invalid request.");
     }
     $tprob = $tprobs[0];
     $today = new DateTime('now');
     $model->set('ttl_lastTrial', $today->format(Model::$SQL_DATE_FORMAT));
     $model->set('ttl_remoteAddr', $_SERVER['REMOTE_ADDR']);
     $output = array();
     $status = 0;
     $text = exec("algoddecrypter " . $model->get('ttl_code'), $output, $status);
     //echo $text;
     $countTrial = true;
     $nTrials = $existent->get("ttl_trials");
     $attenuation = $existent->getForeignModel("ttl_tst_id")->get("tst_scoreAttenuationPerTrial");
     //echo "Att: ".$attenuation;
     //die("<br />Trials: ".$nTrials);
     if ($status != 0) {
         $countTrial = false;
         $model->set("ttl_score", "0");
         $model->set("ttl_hostname", "N/A");
         $model->set("ttl_reason", "<i>Código do corretor submetido foi inválido.</i>");
     } else {
         $mat = "";
         $host = "";
         $question = "";
         $nota = "";
         sscanf($output[0], "%s\t%s\t%d\t%d", $mat, $host, $question, $nota);
         if ($mat == UserSession::getInstance()->getUser()->get('usr_matricula')) {
             if ($question == $tprob->get("tpb_questionNumber")) {
                 $notaAttenuated = $nota * pow($attenuation, $nTrials);
                 //die("Nota: ".$notaAttenuated);
                 $model->set("ttl_score", $notaAttenuated);
                 $model->set("ttl_hostname", $host);
                 $model->set("ttl_reason", "Avaliado pelo corretor.");
             } else {
                 $countTrial = false;
                 $model->set("ttl_score", "0");
                 $model->set("ttl_hostname", $host);
                 $model->set("ttl_reason", "<i>O número da questão no código do corretor não corresponde à esta questão.</i>");
             }
         } else {
             $countTrial = false;
             $model->set("ttl_score", "0");
             $model->set("ttl_hostname", $host);
             $model->set("ttl_reason", "<i>A matrícula passada ao corretor não corresponde à matrícula de seu usuário.</i>");
         }
     }
     $model->set("ttl_sourcefile", mysql_real_escape_string($model->get("ttl_sourcefile")));
     $test = $existent->getForeignModel("ttl_tst_id");
     if ($test->get("tst_enableLogging") != 0) {
         $testBS = new TestBS(null);
         $testBS->logAction(UserSession::getInstance()->getUser()->get('usr_id'), $test->get('tst_id'), "Sumetida tentativa: " . $model->get('ttl_reason') . "\n" . $model->get('ttl_sourcefile'), $model->get('ttl_hostname'), $tprob->get("tpb_questionNumber"), $model->get('ttl_score'));
     }
     @($dao = new DAO(TestTrial));
     if ($countTrial === true) {
         $model->set("ttl_trials", $existent->get("ttl_trials") + 1);
     } else {
         $model->set("ttl_trials", $existent->get("ttl_trials"));
     }
     $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,代码行数:79,代码来源:TestTrialBS.php

示例8: recovery

 public function recovery($email)
 {
     @($dao = new DAO(User));
     $query = new QueryBuilder('user');
     $query->addEqual('usr_email', $email);
     $users = $dao->findByQuery($query);
     if (count($users) != 1) {
         die("Usuário não encontrado.");
     } else {
         $user = $users[0];
         $nome = $user->get('usr_name');
         $passw = generatePassword(9, 8);
         $password = sha1($passw);
         $user->set('usr_password', $password);
         $dao->update($user);
         $mail = new PHPMailer();
         // Charset para evitar erros de caracteres
         $mail->Charset = 'UTF-8';
         // Dados de quem est? enviando o email
         $mail->From = 'emaildoalgod@email.com';
         $mail->FromName = 'Algod';
         // Setando o conteudo
         $mail->IsHTML(true);
         $mail->Subject = 'Redefinicao de senha';
         $mail->Body = 'Voce solicitou a redefinicao da sua senha. Sua senha temporaria e ' . $passw . '<br>Por favor faca login em sua conta e modifique-a';
         $mail->AltBody = 'Voce solicitou a redefinicao da sua senha. Sua senha temporaria e ' . $passw . ' Por favor faca login em sua conta e modifique-a';
         // Validando a autentica??o
         $mail->IsSMTP();
         $mail->SMTPAuth = true;
         $mail->Host = "ssl://smtp.googlemail.com";
         $mail->Port = 465;
         $mail->Username = 'emailalgod@gmail.com';
         $mail->Password = 'coca-cola123';
         // Setando o endere?o de recebimento
         $mail->AddAddress($email, $nome);
         $result = $mail->Send();
         if ($result) {
             return TRUE;
         } else {
             $error = $mail->ErrorInfo;
             die($error);
             //return FALSE;
         }
     }
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:45,代码来源:UserBS.php

示例9: createEditNewStockTransferInvoice

function createEditNewStockTransferInvoice()
{
    $stockTransferInvoiceNo = $_REQUEST['stockTransferInvoiceNo'];
    $sql = "delete from `ems`.`stocktransferinvoice` where `stockTransferInvoiceNo`='{$stockTransferInvoiceNo}'";
    $dao = new DAO();
    $dao->update($sql);
    $dao->createStockTransferInvoice($_REQUEST);
}
开发者ID:htiwari1402,项目名称:ems,代码行数:8,代码来源:control.php

示例10: update

 /**
  * Updates based on the DAO which retrieved it.
  * 
  */
 public function update()
 {
     return $this->_dao->update($this);
 }
开发者ID:wrey75,项目名称:concerto,代码行数:8,代码来源:DBEntity.php


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