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


PHP jDao::createRecord方法代码示例

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


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

示例1: add

 function add()
 {
     $ok = True;
     // Check name
     $name = filter_var($this->param('name'), FILTER_SANITIZE_STRING);
     if (empty($name)) {
         $ok = False;
         jMessage::add('Please give a name', 'error');
     }
     if ($ok) {
         $dao = jDao::get('lizmap~geobookmark');
         $record = jDao::createRecord('lizmap~geobookmark');
         $record->name = $name;
         $params = array();
         foreach ($this->whiteParams as $param) {
             $val = filter_var($this->param($param), FILTER_SANITIZE_STRING);
             $params[$param] = $val;
         }
         $record->map = $params['repository'] . ':' . $params['project'];
         $record->params = json_encode($params);
         $record->login = jAuth::getUserSession()->login;
         // Save the new bookmark
         $id = Null;
         try {
             $id = $dao->insert($record);
         } catch (Exception $e) {
             jLog::log('Error while inserting the bookmark');
             jLog::log($e->getMessage());
             jMessage::add('Error while inserting the bookmark', 'error');
         }
     }
     return $this->getGeoBookmarks($params['repository'], $params['project']);
 }
开发者ID:NaturalGIS,项目名称:lizmap-web-client,代码行数:33,代码来源:geobookmark.classic.php

示例2: save

 /**
  *
  */
 function save()
 {
     $rep = $this->getResponse('json');
     $group_id = $this->param('group_id', '', true);
     $feature_id = $this->param('feature_id');
     //insert
     if (!empty($group_id) && !empty($feature_id)) {
         // instanciation de la factory
         $tb = jDao::get("group_feature");
         // creation d'un record correspondant au dao foo
         $record = jDao::createRecord("group_feature");
         // on remplit le record
         $record->group_id = $group_id;
         $record->feature_id = $feature_id;
         //$groupfeature->icone = $this->saveIcon($icone,$group_id);
         // on le sauvegarde dans la base
         try {
             $tb->insert($record);
             $this->success = true;
             $this->msg = 'fonctionnalité ajoutée';
         } catch (Exception $e) {
             $this->msg = 'fonctionnalité non  ajoutée';
             $this->success = false;
         }
     }
     $rep->data = array('success' => $this->success, 'msg' => $this->msg);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:31,代码来源:groupfeature.classic.php

示例3: createUserObject

 public function createUserObject($login, $password)
 {
     $user = jDao::createRecord($this->_params['dao'], $this->_params['profile']);
     $user->login = $login;
     $user->password = $this->cryptPassword($password);
     return $user;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:7,代码来源:db.auth.php

示例4: save

 /**
  *
  */
 function save()
 {
     $rep = $this->getResponse('json');
     $group_id = $this->intParam('group_id', null, true);
     $user_id = $this->intParam('user_id', null, true);
     //insert
     if (!empty($user_id) && !empty($group_id)) {
         // instanciation de la factory
         $tb = jDao::get("user_group");
         // creation d'un record correspondant au dao foo
         $record = jDao::createRecord("user_group");
         // on remplit le record
         $record->group_id = $group_id;
         $record->user_id = $user_id;
         //$group->icone = $this->saveIcon($icone,$title);
         try {
             $tb->insert($record);
             $this->success = true;
             $this->msg = "groupe ajouté ";
         } catch (Exception $exc) {
             $this->success = false;
             $this->msg = 'groupe non  ajouté';
         }
     }
     $rep->data = array('success' => $this->success, 'msg' => $this->msg);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:30,代码来源:usergroup.classic.php

示例5: testEvents

 function testEvents()
 {
     global $TEST_DAO_EVENTS;
     $TEST_DAO_EVENTS = array();
     $this->emptyTable('product_test');
     $dao = jDao::get('products_events');
     $prod1 = jDao::createRecord('products_events');
     $prod1->name = 'assiette';
     $prod1->price = 3.87;
     $prod2 = jDao::createRecord('products_events');
     $prod2->name = 'assiette';
     $prod2->price = 3.87;
     //$prod2 = clone $prod1;
     $res = $dao->insert($prod2);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoInsertBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoInsertAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertBefore']['record'], $prod1);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertAfter']['record'], $prod2);
     $prod2->name = 'nouvelle assiette';
     $prod = $dao->update($prod2);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoUpdateBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoUpdateAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateBefore']['record'], $prod2);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateAfter']['record'], $prod2);
     $dao->delete(0);
     // unexistant id
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['keys'], array('id' => 0));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['keys'], array('id' => 0));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['result'], 0);
     $dao->delete($prod2->id);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['keys'], array('id' => $prod2->id));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['keys'], array('id' => $prod2->id));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['result'], 1);
     $conditions = jDao::createConditions();
     $conditions->addCondition('id', '=', $prod2->id);
     $dao->deleteBy($conditions);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteByBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteByAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByBefore']['criterias'], $conditions);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByAfter']['result'], 0);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByAfter']['criterias'], $conditions);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:56,代码来源:jdao.events.html_cli.php

示例6: createsave

 function createsave()
 {
     $news = jDao::createRecord('medsite~news');
     $news->sujet = $this->param('sujet');
     $news->texte = $this->param('texte');
     $news->news_date = $this->param('date');
     $dao = jDao::get('medsite~news');
     $dao->insert($news);
     $rep = $this->getResponse('redirect');
     $rep->action = 'medsite~default:index';
     return $rep;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:12,代码来源:default.classic.php

示例7: save

 /**
  *
  */
 function save()
 {
     $rep = $this->getResponse('json');
     $id = $this->intParam('id', 0, true);
     $title = $this->param('title', '', true);
     $code = $this->param('code', '', true);
     $description = $this->param('description');
     if ($id) {
         //update
         if (!empty($title)) {
             // instanciation de la factory
             $this->msg = 'rolee non  modifié';
             // instanciation de la factory
             $tb = jDao::get("role");
             // creation d'un record correspondant au dao foo
             $record = $tb->get($id);
             // on remplit le record
             $record->title = $title;
             $record->code = $code;
             $record->description = $description;
             if (isset($_FILES['icone'])) {
                 $record->icone = $this->saveIcon($_FILES['icone'], $title);
             }
             // on le sauvegarde dans la base
             $this->success = $tb->update($record);
             if ($this->success) {
                 $this->msg = "rolee modifié";
             }
         }
     } else {
         //insert
         if (!empty($title)) {
             $this->msg = 'rolee non  ajouté';
             // instanciation de la factory
             $tb = jDao::get("role");
             // creation d'un record correspondant au dao foo
             $record = jDao::createRecord("role");
             // on remplit le record
             $record->title = $title;
             $record->code = $code;
             $record->description = $description;
             //$role->icone = $this->saveIcon($icone,$title);
             // on le sauvegarde dans la base
             $this->success = $tb->insert($record);
             if ($this->success) {
                 $this->msg = "rolee ajouté ";
             }
         }
     }
     $rep->data = array('success' => $this->success, 'msg' => $this->msg);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:55,代码来源:role.classic.php

示例8: savecreate

 function savecreate()
 {
     $form = jForms::get('files');
     $form->initFromRequest();
     $rep = $this->getResponse('redirect');
     $form->saveAllFiles("files/");
     $dao = jDao::get('files');
     $record = jDao::createRecord('files');
     $record->name = $form->getData('name');
     $record->url = "http://www.helenekling.com/" . $this->testDir . $this->uploadsDirectory . "/" . $form->getData('file');
     $dao->insert($record);
     $rep->action = 'files:index';
     jForms::destroy($this->form);
     return $rep;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:15,代码来源:files.classic.php

示例9: subscribe

 /**
  * Subscribe to a thread
  * @param integer $id of the THREAD! to subscribe
  * @return boolean
  */
 public static function subscribe($id)
 {
     $dao = jDao::get(self::$daoSub);
     if (jAuth::isConnected()) {
         $id_user = jAuth::getUserSession()->id;
         if (!$dao->get($id, $id_user)) {
             $record = jDao::createRecord(self::$daoSub);
             $record->id_post = $id;
             // thread ID
             $record->id_user = $id_user;
             $dao->insert($record);
             return true;
         }
     }
     return false;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:21,代码来源:hfnusub.class.php

示例10: testdao

 function testdao()
 {
     $dao = jDao::get('testnews');
     if ($id = $this->param('newid')) {
         $dao = jDao::get('config');
         $rec = jDao::createRecord('config');
         $rec->ckey = $id;
         $rec->cvalue = $this->param('newvalue', '');
         $dao->insert($rec);
     }
     $rep = $this->getResponse('html');
     $rep->title = 'This is a DAO Test';
     $rep->bodyTpl = 'testapp~main';
     $rep->body->assign('person', 'Laurent');
     $rep->body->assignZone('MAIN', 'test');
     return $rep;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:17,代码来源:main.classic.php

示例11: searchEngineUpdate

 /**
  * manages the content of the search_words table
  * for one post, we update all the words in search_words table
  * @return void
  */
 function searchEngineUpdate()
 {
     if ($this->id == '' or $this->dataSource == '') {
         return;
     }
     // 1) remove all the words of the current datasource in the table of the search engine
     $dao = jDao::get('hfnusearch~searchwords');
     $dao->deleteByIdDataSource($this->id, $this->dataSource);
     // 2) add all the words of the current post
     foreach ($this->getWords() as $word => $weight) {
         $record = jDao::createRecord('hfnusearch~searchwords');
         $record->id = $this->id;
         $record->words = $word;
         $record->weight = $weight;
         $record->datasource = $this->dataSource;
         $dao->insert($record);
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:23,代码来源:search_index.class.php

示例12: saveData

 public function saveData($champs, $rows)
 {
     $s = false;
     $ir = array_search('ID Patient', $rows[0]);
     $reception_id = $rows[1][$ir];
     //
     foreach ($champs as $c) {
         $valeur = '';
         $index = array_search($c->importation, $rows[0]);
         if ($index) {
             $valeur = $rows[1][$index];
             if (strpos($c->importation, "10^(-1)")) {
                 $valeur = (double) $valeur;
                 $valeur = $valeur * 0.1;
             }
         } else {
             $valeur = 0;
         }
         // instanciation de la factory
         $tb = jDao::get("radiologie~resexamen");
         // creation d'un record correspondant au dao
         $record = jDao::createRecord("radiologie~resexamen");
         // on remplit le record
         $user = jAuth::getUserSession();
         $record->user_id = $user->id;
         $record->champ_id = $c->champ_id;
         $record->examen_id = $reception_id;
         $record->acte_id = $c->acte_id;
         $record->valeur = $valeur;
         $record->datecreation = date('Y-d-m H:i:s');
         $record->datemodification = date('Y-d-m H:i:s');
         // on le sauvegarde dans la base
         try {
             //jLog::dump($record);
             $tb->insert($record);
             $s = true;
         } catch (Exception $e) {
             //jLog::dump($e->getTraceAsString());
             $s = false;
         }
     }
     return $s;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:43,代码来源:import.class.php

示例13: insertReadPost

 /**
  * this function save which message from which forum has been read by which user
  * @param record $post record of the current read post
  */
 public function insertReadPost($post, $datePost)
 {
     if ($post->thread_id > 0 and $post->id_forum > 0 and jAuth::isConnected()) {
         $dao = jDao::get('havefnubb~read_posts');
         $id_user = jAuth::getUserSession()->id;
         $exist = $dao->get($id_user, $post->id_forum, $post->thread_id);
         if ($exist === false) {
             $rec = jDao::createRecord('havefnubb~read_posts');
             $rec->id_forum = $post->id_forum;
             $rec->thread_id = $post->thread_id;
             $rec->id_user = $id_user;
             $rec->date_read = $datePost;
             $dao->insert($rec);
         } else {
             $exist->date_read = $datePost;
             $dao->update($exist);
         }
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:23,代码来源:hfnuread.class.php

示例14: prepareToSave

 function prepareToSave()
 {
     $tpl = new jTpl();
     $rep = $this->getResponse('html');
     if ($this->param('id') === null) {
         $form = jForms::fill('NewsLetter~news');
         $dao = jDao::get('NewsLetter~newsLetter');
         $r = jDao::createRecord('NewsLetter~newsLetter');
         $r->date_create = date("Y-m-d");
         $r->text = $form->getData('text');
         $dao->insert($r);
     } else {
         $id = $this->param('id');
         $dao = jDao::get('NewsLetter~newsLetter');
         $r = $dao->get($this->param('id'));
     }
     $actions = array();
     $emails_dao = jDao::get('emails');
     $conds = jDao::createConditions();
     $count = $emails_dao->countBy($conds);
     $email_rate = 2000;
     for ($i = 0; $i <= $count; $i += $email_rate) {
         $action = array();
         $action['inf'] = $i;
         $action['sup'] = $i + $email_rate;
         $action['url'] = 'send';
         $action['id'] = $r->id;
         $actions[] = $action;
     }
     $tpl->assign('actions', $actions);
     $tpl->assign('id', $r->id);
     $emailSrv = new EmailService();
     if ($emailSrv->nbEmailsToSend($r->id) == 0) {
         $emailSrv->resetLogs($r->id);
     }
     $tpl->assign('n_emails', $emailSrv->nbEmailsToSend($r->id));
     $tpl->assign('n_emails_sent', $emailSrv->nbEmailsSent($r->id));
     $tpl->assign('servers', $emailSrv->getServers());
     $tpl->assign('maxMailPerMin', $emailSrv->maxMailPerMin());
     $tpl->assign('maxMailPerDay', $emailSrv->maxMailPerDay());
     $rep->body->assign('MAIN', $tpl->fetch('prepare_sending'));
     return $rep;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:43,代码来源:default.classic.php

示例15: saveRatesBySource

 /**
  * save the Rate to a given source and ID
  * @param integer $id_source the id to link to the source
  * @param string $source the linked source
  * @param integer $rate the rate
  * @return boolean
  */
 function saveRatesBySource($id_source, $source, $rate)
 {
     $dao = jDao::get('hfnurates~rates');
     $id_user = jAuth::isConnected() ? 0 : jAuth::getUserSession()->id;
     $rec = $dao->getByIdSourceSourceRate($id_user, $id_source, $source);
     if ($rec == false) {
         $record = jDao::createRecord('hfnurates~rates');
         $record->id_source = $id_source;
         $record->id_user = $id_user;
         $record->source = $source;
         $record->level = $rate;
         $record->ip = $_SERVER['REMOTE_ADDR'];
         $dao->insert($record);
     } else {
         $rec->level = $rate;
         $dao->update($rec);
     }
     jZone::clear("hfnurates~rates");
     return true;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:27,代码来源:rates.class.php


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