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


PHP Mapper::add方法代码示例

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


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

示例1: create

 /**
  * Create a new token and return it.
  */
 public static function create()
 {
     $value = uniqid();
     $tokenObject = new Token();
     $tokenObject->value = $value;
     Mapper::add($tokenObject);
     return $value;
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:11,代码来源:token.controller.php

示例2: add

 /**
  */
 public static function add($userID, $tagName, $tagColor)
 {
     $tagObject = new Tag();
     $tagObject->user_id = $userID;
     $tagObject->name = $tagName;
     $tagObject->color = $tagColor;
     $tagsID = Mapper::add($tagObject);
     $tags = '';
     // loop through results and create html
     $n = new Template('feed_tag.html');
     $n->replace('USER_ID', $userID);
     $n->replace('TAG_ID', $tagsID);
     $n->replace('TAG_NAME', $tagName);
     $n->replace('TAG_COLOR', $tagColor);
     $n->replace('TEXT_COLOR', invertColor($tagColor));
     $n->replace('LOCATION', 'inmodal');
     $tags .= $n;
     return array('tagshtml' => $tags, 'tags' => $tagsID);
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:21,代码来源:tag.controller.php

示例3: update_map

 public function update_map(Mapper $mapper)
 {
     $mapper->add('issue', $this->old_id_, $this->new_id_);
 }
开发者ID:kaos,项目名称:mantisbt,代码行数:4,代码来源:Issue.php

示例4: AddStudy

 public static function AddStudy(&$db, &$process_file, &$study_chris_id, &$study_description)
 {
     $db->lock('study', 'WRITE');
     // Does data exist: SeriesInstanceUID
     if (array_key_exists('StudyInstanceUID', $process_file)) {
         // does study exist??
         $studyMapper = new Mapper('Study');
         $studyMapper->filter('uid = (?)', $process_file['StudyInstanceUID'][0]);
         $studyResult = $studyMapper->get();
         // if study doesn't exist, create it
         if (count($studyResult['Study']) == 0) {
             // create object
             // create data model
             $studyObject = new Study();
             //
             // get data uid
             //
             $studyObject->uid = $process_file['StudyInstanceUID'][0];
             //
             // get data name (series description)
             //
             if (array_key_exists('StudyDescription', $process_file)) {
                 $studyObject->description = sanitize($process_file['StudyDescription'][0]);
             } else {
                 $studyObject->description = 'NoStudyDescription';
             }
             if (array_key_exists('Modality', $process_file)) {
                 $studyObject->modality = sanitize($process_file['Modality'][0]);
             } else {
                 $studyObject->modality = 'NoModality';
             }
             if (array_key_exists('StudyDate', $process_file)) {
                 $studyObject->date = PACS::getDate($process_file);
             }
             $studyObject->age = PACS::getAge($process_file);
             $studyObject->location = PACS::getLocation($process_file);
             $study_description = formatStudy($studyObject->date, $studyObject->age, $studyObject->description);
             $study_chris_id = Mapper::add($studyObject);
         } else {
             // Content to be updated
             if ($studyResult['Study'][0]->age == -1) {
                 //
                 // get data name (series description)
                 //
                 if (array_key_exists('StudyDescription', $process_file)) {
                     $studyResult['Study'][0]->description = sanitize($process_file['StudyDescription'][0]);
                 } else {
                     $studyResult['Study'][0]->description = 'NoStudyDescription';
                 }
                 if (array_key_exists('Modality', $process_file)) {
                     $studyResult['Study'][0]->modality = sanitize($process_file['Modality'][0]);
                 } else {
                     $studyResult['Study'][0]->modality = 'NoModality';
                 }
                 $studyResult['Study'][0]->date = PACS::getDate($process_file);
                 $studyResult['Study'][0]->age = PACS::getAge($process_file);
                 $studyResult['Study'][0]->location = PACS::getLocation($process_file);
                 $study_description = formatStudy($studyResult['Study'][0]->date, $studyResult['Study'][0]->age, $studyResult['Study'][0]->description);
                 $study_chris_id = $studyResult['Study'][0]->id;
                 Mapper::update($studyResult['Study'][0], $studyResult['Study'][0]->id);
             } else {
                 $study_chris_id = $studyResult['Study'][0]->id;
                 $study_description = formatStudy($studyResult['Study'][0]->date, $studyResult['Study'][0]->age, $studyResult['Study'][0]->description);
             }
         }
     } else {
         echo 'Study UID not provided in DICOM file' . PHP_EOL;
         // finish data table lock
         $db->unlock();
         return 0;
     }
     // finish data table lock
     $db->unlock();
     return 1;
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:75,代码来源:pacs.helper.php

示例5: tag

 public static function tag($feedid, $tagid, $remove)
 {
     if ($remove == 'false') {
         // is tag feed already?
         $feedtagMapper = new Mapper('Feed_Tag');
         $feedtagMapper->filter('feed_id=(?)', $feedid);
         $feedtagMapper->filter('tag_id=(?)', $tagid);
         $feedtadResults = $feedtagMapper->get();
         if (count($feedtadResults['Feed_Tag']) >= 1) {
             return -1;
         }
         $tagObject = new Feed_Tag();
         $tagObject->feed_id = $feedid;
         $tagObject->tag_id = $tagid;
         return Mapper::add($tagObject);
     } else {
         // is tag feed already?
         $feedtagMapper = new Mapper('Feed_Tag');
         $feedtagMapper->filter('feed_id=(?)', $feedid);
         $feedtagMapper->filter('tag_id=(?)', $tagid);
         $feedtadResults = $feedtagMapper->get();
         if (count($feedtadResults['Feed_Tag']) >= 1) {
             Mapper::delete('Feed_Tag', $feedtadResults['Feed_Tag'][0]->id);
             return 1;
         }
         return -1;
     }
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:28,代码来源:feed.controller.php

示例6: testUpdate

 public function testUpdate()
 {
     // get a patient by id
     $patientObject = new Patient();
     $patientObject->name = 'PLN2';
     $patientObject->dob = '2002-01-01';
     $patientObject->sex = 'F';
     $patientObject->uid = 'PID2;';
     $patientID = Mapper::add($patientObject);
     // Modify one field
     $patientObject->name = 'PLN3';
     // Update database and get object
     Mapper::update($patientObject, $patientID);
     $patientResult = Mapper::getStatic('Patient', $patientID);
     // compared object we just added with its "base" object
     // we make sure id match
     $patientObject->id = $patientID;
     $this->assertTrue($patientResult['Patient'][0]->equals($patientObject) == True);
     // update "silly" object to create one object which alread exists
     $existingID = Mapper::update($patientObject, -1);
     // should return the id of the object which already exists
     $this->assertTrue($patientID == $existingID);
     //update object that does not exist
     $patientObject->name = 'PLN4';
     $existingID = Mapper::update($patientObject, -1);
     // update should return 0 if object does not exist
     $this->assertTrue($existingID == 0);
     // clean the DB
     Mapper::delete('Patient', $patientID);
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:30,代码来源:test.mapper.class.php

示例7: add

 /**
  * Add record
  *
  * @param array $values
  * @return int
  */
 public static function add(array $values)
 {
     return Mapper::add(get_called_class(), $values);
 }
开发者ID:lucasnpinheiro,项目名称:orm-1,代码行数:10,代码来源:Model.php

示例8: Mapper

     $study_chris_id = Mapper::add($studyObject);
     $addDataLog .= 'Study created..' . PHP_EOL;
 } else {
     $study_chris_id = $studyResult['Study'][0]->id;
     $addDataLog .= 'Study already exists..' . PHP_EOL;
 }
 // MAP DATA TO STUDY
 $dataStudyMapper = new Mapper('Data_Study');
 $dataStudyMapper->filter('data_id = (?)', $data_chris_id);
 $dataStudyMapper->filter('study_id = (?)', $study_chris_id);
 $dataStudyResult = $dataStudyMapper->get();
 if (count($dataStudyResult['Data_Study']) == 0) {
     $dataStudyObject = new Data_Study();
     $dataStudyObject->data_id = $data_chris_id;
     $dataStudyObject->study_id = $study_chris_id;
     Mapper::add($dataStudyObject);
     $addDataLog .= 'Map data to its study...' . PHP_EOL;
 }
 // move series (data)
 $try = 0;
 while ($request_data && $try < 5) {
     $pacs2 = new PACS($server, $port, $aetitle, $aec);
     echo $server . PHP_EOL;
     echo $port . PHP_EOL;
     echo $aetitle . PHP_EOL;
     $pacs2->addParameter('StudyInstanceUID', $results[1]['StudyInstanceUID'][$key]);
     $pacs2->addParameter('SeriesInstanceUID', $results[1]['SeriesInstanceUID'][$key]);
     $push_request = $pacs2->moveSeries();
     $addDataLog .= $push_request['command'] . PHP_EOL;
     if ($push_request['output'] == '') {
         $addDataLog .= 'Move data success...' . PHP_EOL;
开发者ID:BU-NU-CLOUD-SP16,项目名称:Radiology-in-the-cloud,代码行数:31,代码来源:process.php

示例9: Mapper

     $mapping_id = Mapper::add($dataPatientObject);
     $logFile .= 'patient data id: ' . $mapping_id . PHP_EOL;
 } else {
     $logFile .= 'Patient already mapped to data...' . PHP_EOL;
     $logFile .= 'patient data id: ' . $dataPatientResult['Data_Patient'][0]->id . PHP_EOL;
 }
 // MAP DATA TO STUDY
 $dataStudyMapper = new Mapper('Data_Study');
 $dataStudyMapper->filter('data_id = (?)', $data_chris_id);
 $dataStudyMapper->filter('study_id = (?)', $study_chris_id);
 $dataStudyResult = $dataStudyMapper->get();
 if (count($dataStudyResult['Data_Study']) == 0) {
     $dataStudyObject = new Data_Study();
     $dataStudyObject->data_id = $data_chris_id;
     $dataStudyObject->study_id = $study_chris_id;
     $mapping_data_study_id = Mapper::add($dataStudyObject);
     $logFile .= 'data study id: ' . $mapping_data_study_id . PHP_EOL;
 } else {
     $logFile .= 'Study already mapped to data...' . PHP_EOL;
     $logFile .= 'data study id: ' . $dataStudyResult['Data_Study'][0]->id . PHP_EOL;
 }
 // FILESYSTEM Processing
 //
 // Create the patient directory
 //
 $logFile .= '**** FILESYSTEM processing ****' . PHP_EOL;
 $patientdirname = CHRIS_DATA . '/' . $process_file['PatientID'][0] . '-' . $patient_chris_id;
 // create folder if doesnt exists
 if (!is_dir($patientdirname)) {
     mkdir($patientdirname);
     $logFile .= 'MKDIR: ' . $patientdirname . PHP_EOL;
开发者ID:masroore,项目名称:chrisreloaded,代码行数:31,代码来源:pacs.handler.php

示例10: create

 /**
  * Create a new user.
  *
  * @param string $username
  * @param string $password
  * @param string $email
  */
 public static function create($uid, $username)
 {
     // create user and add it to db
     $userObject = new User();
     $userObject->id = strval($uid);
     $userObject->username = $username;
     $userObject->password = 'password';
     $userObject->email = $username . CHRIS_MAIL_SUFFIX;
     return Mapper::add($userObject);
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:17,代码来源:user.controller.php


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