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


PHP Course::setChildren方法代码示例

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


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

示例1: getDemoCourseDetail

 /**
  * A sample detail bean for use in rendering the template.
  * If a course is supplied, it will copy thevalues of the
  * given bean over the top of the demo bean.
  * @return
  */
 private function getDemoCourseDetail($crse)
 {
     require_once WEB_INF . '/beans/Performance.php';
     require_once WEB_INF . '/beans/Schedule.php';
     require_once WEB_INF . '/beans/Venue.php';
     global $logger;
     $logger->debug(get_class($this) . "::getDemoCourseDetail({$crse})");
     $bean = new Course();
     $bean->setTitle("Demo Course Detail Bean");
     $desc = "<p>This is a description of the course. Malian Grammy Award nominee Mamadou Diabate is a virtuoso kora player descended from a long line of Manding musician-storytellers. Dolor dignissim exerci feugiat. Lobortis ut, luptatum facilisis. Augue volutpat facilisis at, eum consequat adipiscing accumsan blandit molestie. </p>\n\t\t\t\t <p>Lobortis eros at hendrerit luptatum consequat feugiat ut facilisi commodo esse autem consequat at ex ullamcorper hendrerit wisi, commodo nostrud nisl wisi eum autem eu esse eu iriure. Tation, magna ad nibh at eum, ea praesent eum lorem eu erat enim commodo dolore?</p>\n \t\t\t\t <p>Crisare enim sed ex eros hendrerit blandit illum qui sciurus autem nulla enim luptatum. Quis enim eum feugait elit blandit, hendrerit consequat, velit ut luptatum nostrud wisi ea. Dignissim consequat dolore aliquam eum volutpat, wisi dolore et exerci nisl veniam luptatum ut ullamcorper consequatvel nulla delenit.</p>\n\t\t\t\t";
     $bean->setDescription($desc);
     $bean->setPrimaryGenre("Music");
     // Performances
     $perf = new Performance();
     $schd = new Schedule();
     $schd->setStartTime(time());
     $perf->setSchedule($schd);
     $logger->debug("Performance time: " . $perf->getSchedule()->getStartTime());
     $perf->setTicketCode("21");
     $bean->setChildren(array($perf));
     $logger->debug("Number of set performaces: " . count($bean->getChildren()));
     // Venues
     $v1 = new Venue();
     $v1->setName('Hurd Gallery');
     $bean->setDefaultVenue($v1);
     if (get_class($crse) == 'Course') {
         $crse->setPerformances(null);
         $option = new CopyBeanOption();
         $option->setIgnoreNullValues(true);
         BeanUtil::copyBean($crse, $bean, $option);
     }
     return $bean;
 }
开发者ID:justinlyon,项目名称:scc,代码行数:39,代码来源:FrontCourseAction.php

示例2: coursePdoToBean

 /**
  * Converts the given course PDO to a bean object.
  * This includes the conversion from nested lists
  * of PDO objects to usable lists of oids/names to be used
  * by the page renderer.
  *
  * @access private
  * @param pdo $pdo Course
  * @return bean Course
  */
 private function coursePdoToBean($pdo)
 {
     require_once WEB_INF . '/beans/Seminar.php';
     global $logger;
     $logger->debug(get_class($this) . "::coursePdoToBean({$pdo})");
     $copyOption = new CopyBeanOption();
     $copyOption->setUseTargetVars(true);
     $copyOption->setScalarsOnly(true);
     $bean = new Course($pdo->epGetVars());
     // primaryGenre to bean
     $genre = $pdo->getPrimaryGenre();
     $ga = $genre != null ? $genre->epGetVars() : null;
     $bean->setPrimaryGenre(new Genre($ga));
     // pubState to a string
     $ps = '';
     if ($pdo->getPubState() != null) {
         $ps = $pdo->getPubState()->getValue();
     }
     $bean->setPubState($ps);
     // eventStatus to a string
     $es = '';
     if ($pdo->getEventStatus() != null) {
         $es = $pdo->getEventStatus()->getValue();
     }
     $bean->setEventStatus($es);
     // default venue from pdo to bean
     $dven = $pdo->getDefaultVenue();
     $logger->debug("Getting default venue from the course pdo: " . $pdo->getDefaultVenue());
     $dv = $dven != null ? $dven->epGetVars() : null;
     $bean->setDefaultVenue(new Venue($dv));
     $logger->debug("Setting default venue in the course bean: " . $bean->getDefaultVenue()->getName());
     // venues from array of pdos to array of venue bean
     $vens = array();
     if ($pdo->getVenues() != null) {
         foreach ($pdo->getVenues() as $ven) {
             $vens[] = new Venue($ven->epGetVars());
         }
     }
     $bean->setVenues($vens);
     // categories from array of pdos to keyed array of oids
     $cats = array();
     if ($pdo->getCategories() != null) {
         foreach ($pdo->getCategories() as $cat) {
             $scope = $cat->getScope();
             $cats[$scope][] = new $scope($cat->epGetVars());
         }
     }
     $bean->setCategories($cats);
     // related exhibitions from array of pdos to keyed array of oids
     $exhibitions = $pdo->getExhibitions();
     if ($exhibitions != null) {
         $related = array();
         foreach ($exhibitions as $event) {
             $related[] = new Exhibition($event->epGetVars());
         }
         $bean->setExhibitions($related);
     }
     // related programs from array of pdos to keyed array of oids
     $programs = $pdo->getPrograms();
     if ($programs != null) {
         $related = array();
         foreach ($programs as $event) {
             $related[] = new Program($event->epGetVars());
         }
         $bean->setPrograms($related);
     }
     // related performances from array of pdos to array of activities
     $children = $pdo->getChildren();
     if ($children != null) {
         $activities = array();
         foreach ($children as $activity) {
             $scope = $activity->getScope();
             $perf = new $scope($activity->epGetVars());
             $perf->setActivityStatus(new EventStatus($activity->getActivityStatus()->epGetVars()));
             $perf->setSchedule(new Schedule($activity->getSchedule()->epGetVars()));
             if ($activity->getVenue()) {
                 $perf->setVenue(new Venue($activity->getVenue()->epGetVars()));
             }
             $activities[] = $perf;
         }
         $bean->setChildren($activities);
     }
     return $bean;
 }
开发者ID:justinlyon,项目名称:scc,代码行数:94,代码来源:EventService.php

示例3: getBeanFromRequest


//.........这里部分代码省略.........
     $crse = new Course($_REQUEST);
     $crse->setInstructorBio($crse->getInstructorbio());
     $genre = new Genre();
     $genre->setOid($_REQUEST['primaryGenre']);
     $crse->setPrimaryGenre($genre);
     if (isset($_REQUEST['defaultVenue'])) {
         $venue = new Venue();
         $venue->setOid($_REQUEST['defaultVenue']);
         $crse->setVenues(array($venue));
     }
     // categories
     $cats = array();
     if (isset($_REQUEST['audience'])) {
         foreach ($_REQUEST['audience'] as $oid) {
             $category = new Audience();
             $category->setOid($oid);
             $cats['audience'][] = $category;
         }
     }
     if (isset($_REQUEST['genre'])) {
         foreach ($_REQUEST['genre'] as $oid) {
             $category = new Genre();
             $category->setOid($oid);
             $cats['genre'][] = $category;
         }
     }
     if (isset($_REQUEST['series'])) {
         foreach ($_REQUEST['series'] as $oid) {
             $category = new Series();
             $category->setOid($oid);
             $cats['series'][] = $category;
         }
     }
     if (isset($cats['audience'])) {
         $logger->debug("Number of audience categories in the form: " . count($cats['audience']));
     }
     if (isset($cats['genre'])) {
         $logger->debug("Number of genre categories in the form: " . count($cats['genre']));
     }
     if (isset($cats['series'])) {
         $logger->debug("Number of series categories in the form: " . count($cats['series']));
     }
     if (isset($cats['audience']) || isset($cats['genre']) || isset($cats['series'])) {
         $crse->setCategories($cats);
     }
     // related events
     $events = array();
     if (isset($_REQUEST['exhibition'])) {
         foreach ($_REQUEST['exhibition'] as $oid) {
             $exhibition = new Exhibition();
             $exhibition->setOid($oid);
             $events[] = $exhibition;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related exhibitions in the form: " . count($events));
         $crse->setExhibitions($events);
     }
     $events = array();
     if (isset($_REQUEST['program'])) {
         foreach ($_REQUEST['program'] as $oid) {
             $program = new Program();
             $program->setOid($oid);
             $events[] = $program;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related programs in the form: " . count($events));
         $crse->setPrograms($events);
     }
     $activities = array();
     if (isset($_REQUEST['activityChanged']) && $_REQUEST['activityChanged']) {
         // parse delimited attributes as pipe-delimited '|' string
         $startTimes = explode('|', $_REQUEST['activityStartTime']);
         $endTimes = explode('|', $_REQUEST['activityEndTime']);
         $venues = explode('|', $_REQUEST['activityVenueList']);
         $status = explode('|', $_REQUEST['activityStatusList']);
         $tickets = explode('|', $_REQUEST['activityTicketList']);
         for ($index = 0; $index < count($venues); $index++) {
             $schedule = new Schedule();
             $stint = strtotime($startTimes[$index]);
             $etint = strtotime($endTimes[$index]);
             $schedule->setStartTime($stint);
             $schedule->setEndTime($etint);
             $venue = new Venue();
             $venue->setOid($venues[$index]);
             $activity = new Performance();
             $activity->setSchedule($schedule);
             $activity->setVenue($venue);
             $activity->setActivityStatus($status[$index]);
             $activity->setTicketCode($tickets[$index]);
             $activities[] = $activity;
         }
     }
     if (isset($activities)) {
         $logger->debug("Number of related performances in the form: " . count($activities));
         $crse->setChildren($activities);
     }
     return $crse;
 }
开发者ID:justinlyon,项目名称:scc,代码行数:101,代码来源:CourseAction.php


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