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


PHP Track::setSequence方法代码示例

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


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

示例1: handleTrackNode


//.........这里部分代码省略.........
     // existing track, but not the same track, throw an error.
     $track = null;
     $foundTrackId = $foundTrackTitle = null;
     $index = 0;
     foreach ($titles as $locale => $title) {
         $track = $trackDao->getTrackByTitle($title, $schedConf->getId());
         if ($track) {
             $trackId = $track->getId();
             if ($foundTrackId) {
                 if ($foundTrackId != $trackId) {
                     // Mismatching tracks found. Throw an error.
                     $errors[] = array('plugins.importexport.native.import.error.trackTitleMismatch', array('track1Title' => $title, 'track2Title' => $foundTrackTitle));
                     return false;
                 }
             } else {
                 if ($index > 0) {
                     // the current title matches, but the prev titles didn't => error
                     $errors[] = array('plugins.importexport.native.import.error.trackTitleMatch', array('trackTitle' => $title));
                     return false;
                 }
             }
             $foundTrackId = $trackId;
             $foundTrackTitle = $title;
         } else {
             if ($foundTrackId) {
                 // a prev title matched, but the current doesn't => error
                 $errors[] = array('plugins.importexport.native.import.error.trackTitleMatch', array('trackTitle' => $foundTrackTitle));
                 return false;
             }
         }
         $index++;
     }
     // check abbrevs:
     $abbrevTrack = null;
     $foundTrackId = $foundTrackAbbrev = null;
     $index = 0;
     foreach ($abbrevs as $locale => $abbrev) {
         $abbrevTrack = $trackDao->getTrackByAbbrev($abbrev, $schedConf->getId());
         if ($abbrevTrack) {
             $trackId = $abbrevTrack->getTrackId();
             if ($foundTrackId) {
                 if ($foundTrackId != $trackId) {
                     // Mismatching tracks found. Throw an error.
                     $errors[] = array('plugins.importexport.native.import.error.trackAbbrevMismatch', array('track1Abbrev' => $abbrev, 'track2Abbrev' => $foundTrackAbbrev));
                     return false;
                 }
             } else {
                 if ($index > 0) {
                     // the current abbrev matches, but the prev abbrevs didn't => error
                     $errors[] = array('plugins.importexport.native.import.error.trackAbbrevMatch', array('trackAbbrev' => $trackAbbrev));
                     return false;
                 }
             }
             $foundTrackId = $trackId;
             $foundTrackAbbrev = $abbrev;
         } else {
             if ($foundTrackId) {
                 // a prev abbrev matched, but the current doesn't => error
                 $errors[] = array('plugins.importexport.native.import.error.trackAbbrevMatch', array('trackAbbrev' => $foundTrackAbbrev));
                 return false;
             }
         }
         $index++;
     }
     if (!$track && !$abbrevTrack) {
         // The track was not matched. Create one.
         // Note that because tracks are global-ish,
         // we're not maintaining a list of created
         // tracks to delete in case the import fails.
         unset($track);
         $track = new Track();
         $track->setTitle($titles, null);
         $track->setAbbrev($abbrevs, null);
         $track->setIdentifyType($identifyTypes, null);
         $track->setPolicy($policies, null);
         $track->setSchedConfId($schedConf->getId());
         $track->setSequence(REALLY_BIG_NUMBER);
         $track->setMetaIndexed(1);
         $track->setEditorRestricted(1);
         $track->setTrackId($trackDao->insertTrack($track));
         $trackDao->resequenceTracks($schedConf > getSchedConfId());
     }
     if (!$track && $abbrevTrack) {
         unset($track);
         $track =& $abbrevTrack;
     }
     // $track *must* now contain a valid track, whether it was
     // found amongst existing tracks or created anew.
     $hasErrors = false;
     for ($index = 0; $node = $trackNode->getChildByName('paper', $index); $index++) {
         if (!NativeImportDom::handlePaperNode($conference, $schedConf, $node, $track, $paper, $publishedPaper, $paperErrors, $user, $isCommandLine, $dependentItems)) {
             $errors = array_merge($errors, $paperErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     return true;
 }
开发者ID:jalperin,项目名称:ocs,代码行数:101,代码来源:NativeImportDom.inc.php

示例2: execute

 /**
  * Save track.
  */
 function execute()
 {
     $schedConf =& Request::getSchedConf();
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     if (isset($this->trackId)) {
         $track =& $trackDao->getTrack($this->trackId);
     }
     if (!isset($track)) {
         $track = new Track();
         $track->setSchedConfId($schedConf->getId());
         $track->setSequence(REALLY_BIG_NUMBER);
     }
     $track->setTitle($this->getData('title'), null);
     // Localized
     $track->setAbbrev($this->getData('abbrev'), null);
     // Localized
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $track->setReviewFormId($reviewFormId);
     $track->setMetaReviewed($this->getData('metaNotReviewed') ? 0 : 1);
     $track->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $track->setDirectorRestricted($this->getData('directorRestriction') ? 1 : 0);
     $track->setPolicy($this->getData('policy'), null);
     // Localized
     $track->setHideAbout($this->getData('hideAbout'));
     $track->setDisableComments($this->getData('disableComments') ? 1 : 0);
     $track->setAbstractWordCount($this->getData('wordCount'));
     if ($track->getId() != null) {
         $trackDao->updateTrack($track);
         $trackId = $track->getId();
     } else {
         $trackId = $trackDao->insertTrack($track);
         $trackDao->resequenceTracks($schedConf->getId());
     }
     // Save assigned directors
     $trackDirectorsDao =& DAORegistry::getDAO('TrackDirectorsDAO');
     $trackDirectorsDao->deleteDirectorsByTrackId($trackId, $schedConf->getId());
     $directors = explode(':', Request::getUserVar('assignedDirectors'));
     foreach ($directors as $edUserId) {
         if (!empty($edUserId)) {
             $trackDirectorsDao->insertDirector($schedConf->getId(), $trackId, $edUserId);
         }
     }
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:50,代码来源:TrackForm.inc.php

示例3: importPapers

 /**
  * Import papers (including metadata and files).
  */
 function importPapers()
 {
     if ($this->hasOption('verbose')) {
         printf("Importing papers\n");
     }
     import('classes.file.PaperFileManager');
     import('classes.search.PaperSearchIndex');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
     $unassignedTrackId = null;
     $result =& $this->importDao->retrieve('SELECT * FROM papers ORDER by id');
     while (!$result->EOF) {
         $row =& $result->fields;
         $schedConf =& $this->schedConfMap[$row['cf']];
         $schedConfId = $schedConf->getId();
         // Bring in the primary user for this paper.
         $user = $userDao->getUserByUsername(Core::cleanVar($row['login']));
         if (!$user) {
             unset($user);
             $user = new User();
             $user->setUsername(Core::cleanVar($row['login']));
             $user->setFirstName(Core::cleanVar($row['first_name']));
             $user->setLastName(Core::cleanVar($row['surname']));
             $user->setAffiliation(Core::cleanVar($row['affiliation']), Locale::getLocale());
             $user->setEmail(Core::cleanVar($row['email']));
             $user->setUrl(Core::cleanVar($row['url']));
             $user->setBiography(Core::cleanVar($row['bio']), Locale::getLocale());
             $user->setLocales(array());
             $user->setDateRegistered($row['created']);
             $user->setDateLastLogin($row['created']);
             $user->setMustChangePassword(1);
             $password = Validation::generatePassword();
             $user->setPassword(Validation::encryptCredentials($user->getUsername(), $password));
             if ($this->hasOption('emailUsers')) {
                 import('classes.mail.MailTemplate');
                 $mail = new MailTemplate('USER_REGISTER');
                 $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                 $mail->assignParams(array('username' => $user->getUsername(), 'password' => $password, 'conferenceName' => $schedConf->getFullTitle()));
                 $mail->addRecipient($user->getEmail(), $user->getFullName());
                 $mail->send();
             }
             $user->setDisabled(0);
             $otherUser =& $userDao->getUserByEmail(Core::cleanVar($row['email']));
             if ($otherUser !== null) {
                 // User exists with this email -- munge it to make unique
                 $user->setEmail('ocs-' . Core::cleanVar($row['login']) . '+' . Core::cleanVar($row['email']));
                 $this->conflicts[] = array(&$otherUser, &$user);
             }
             unset($otherUser);
             $userDao->insertUser($user);
             // Make this user a author
             $role = new Role();
             $role->setSchedConfId($schedConf->getId());
             $role->setConferenceId($schedConf->getConferenceId());
             $role->setUserId($user->getId());
             $role->setRoleId(ROLE_ID_AUTHOR);
             $roleDao->insertRole($role);
             unset($role);
         }
         $userId = $user->getId();
         // Bring in the basic entry for the paper
         $paper = new Paper();
         $paper->setUserId($userId);
         $paper->setLocale(Locale::getPrimaryLocale());
         $paper->setSchedConfId($schedConfId);
         $oldTrackId = $row['primary_track_id'];
         if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) {
             $oldTrackId = $row['secondary_track_id'];
         }
         if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) {
             if (!$unassignedTrackId) {
                 // Create an "Unassigned" track to use for submissions
                 // that didn't have a track in OCS 1.x.
                 $track = new Track();
                 $track->setSchedConfId($schedConf->getId());
                 $track->setTitle('UNASSIGNED', Locale::getLocale());
                 $track->setSequence(REALLY_BIG_NUMBER);
                 $track->setDirectorRestricted(1);
                 $track->setMetaReviewed(1);
                 $unassignedTrackId = $trackDao->insertTrack($track);
             }
             $newTrackId = $unassignedTrackId;
         } else {
             $newTrackId = $this->trackMap[$oldTrackId];
         }
         $paper->setTrackId($newTrackId);
         $paper->setTitle(Core::cleanVar($row['title']), Locale::getLocale());
         $paper->setAbstract(Core::cleanVar($row['abstract']), Locale::getLocale());
         $paper->setDiscipline(Core::cleanVar($row['discipline']), Locale::getLocale());
         $paper->setSponsor(Core::cleanVar($row['sponsor']), Locale::getLocale());
         $paper->setSubject(Core::cleanVar($row['topic']), Locale::getLocale());
         $paper->setLanguage(Core::cleanVar($row['language']));
         $paper->setDateSubmitted($row['created']);
//.........这里部分代码省略.........
开发者ID:ramonsodoma,项目名称:ocs,代码行数:101,代码来源:ImportOCS1.inc.php

示例4: Track

 /**
  * Internal function to return a Track object from a row.
  * @param $row array
  * @return Track
  */
 function &_returnTrackFromRow(&$row)
 {
     $track = new Track();
     $track->setId($row['track_id']);
     $track->setSchedConfId($row['sched_conf_id']);
     $track->setReviewFormId($row['review_form_id']);
     $track->setSequence($row['seq']);
     $track->setMetaReviewed($row['meta_reviewed']);
     $track->setDirectorRestricted($row['director_restricted']);
     $track->setHideAbout($row['hide_about']);
     $track->setDisableComments($row['disable_comments']);
     $track->setAbstractWordCount($row['abstract_word_count']);
     $this->getDataObjectSettings('track_settings', 'track_id', $row['track_id'], $track);
     HookRegistry::call('TrackDAO::_returnTrackFromRow', array(&$track, &$row));
     return $track;
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:21,代码来源:TrackDAO.inc.php


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