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


PHP SimpleORMap::getId方法代码示例

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


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

示例1: afterUpdate

 public function afterUpdate(SimpleORMap $object, $line)
 {
     $old_domains = array_map(function ($domain) {
         return $domain->getID();
     }, $this->old_domains);
     $new_domains = UserDomain::getUserDomainsForUser($object->getId());
     foreach ($new_domains as $domain_id) {
         if (!in_array($domain_id, $old_domains)) {
             if ($domain_id === "alumni") {
                 if (count($new_domains) == 1) {
                     $statement = DBManager::get()->prepare("\n                            SELECT seminar_user.Seminar_id \n                            FROM seminar_user\n                                LEFT JOIN seminar_userdomain ON (seminar_user.Seminar_id = seminar_userdomain.Seminar_id)\n                            WHERE seminar_user.user_id = :user_id\n                                AND seminar_user.Seminar_id NOT IN (SELECT seminar_id FROM seminar_userdomain WHERE userdomain_id = 'alumni')\n                        ");
                     $statement->execute(array('user_id' => $object->getId()));
                     foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $seminar_id) {
                         $seminar = new Seminar($seminar_id);
                         $seminar->deleteMember($object->getId());
                     }
                 }
                 $datafield = Datafield::findOneBySQL("name = 'Ich will weiterhin als Alumni in Stud.IP geführt werden' AND object_type = 'user'");
                 $user_wants_to_stay = DatafieldEntry::findOneBySQL("datafield_id = ? AND range_id = ?", array($datafield->getId(), $object->getId()));
                 if ($user_wants_to_stay['content']) {
                     //In Veranstaltung ALUMNI die Statusgruppe anlegen:
                     $datafield = Datafield::findOneBySQL("name = 'Alumni' AND object_type = 'user'");
                     $entry = DatafieldEntry::findOneBySQL("datafield_id = ? AND range_id = ?", array($datafield->getId(), $object->getId()));
                     $course = Course::findOneByName("ALUMNI");
                     $gruppenname = $entry ? $entry['content'] : null;
                     if ($course && $gruppenname) {
                         $statusgruppe = Statusgruppen::findOneBySQL("name = ? range_id = ?", array($gruppenname, $course->getId()));
                         if (!$statusgruppe) {
                             $statusgruppe = new Statusgruppen();
                             $statusgruppe['name'] = $gruppenname;
                             $statusgruppe['range_id'] = $course->getId();
                             $statusgruppe->store();
                         }
                         if (!$statusgruppe->isMember($object->getId())) {
                             $statusgruppe->addUser($object->getId());
                         }
                     }
                 } else {
                     $object->delete();
                     $deleted = true;
                 }
             }
         }
     }
 }
开发者ID:Krassmus,项目名称:Fleximport,代码行数:45,代码来源:fleximport_pan_userimport.php

示例2: afterUpdate

 /**
  * Import and update the dates
  */
 public function afterUpdate(SimpleORMap $object, $line)
 {
     $weekdays = array('so' => 0, 'su' => 0, 'mo' => 1, 'di' => 2, 'die' => 2, 'tue' => 2, 'mi' => 3, 'we' => 3, 'do' => 4, 'thu' => 4, 'fr' => 5, 'fri' => 5, 'sa' => 6);
     $zeiten = $line['zeit'];
     $zeiten = preg_split("/\\s*,\\s*/", $zeiten, null, PREG_SPLIT_NO_EMPTY);
     $singledates = array();
     $metadates = array();
     $import_type_dates = "karlsruhe_coursedates_import_" . $object->getId();
     $import_type_metadates = "karlsruhe_coursemetadates_import_" . $object->getId();
     foreach ($zeiten as $zeit) {
         if (!is_numeric(trim($zeit[0]))) {
             preg_match("/(\\w+) (\\d+):(\\d+)\\s*-\\s*(\\d+):(\\d+)/", $zeit, $matches);
             $day = strtolower($matches[1]);
             if (isset($weekdays[$day])) {
                 $statement = DBManager::get()->prepare("\n                        SELECT metadate_id \n                        FROM seminar_cycle_dates \n                        WHERE seminar_id = :course_id\n                            AND start_time = :start_time\n                            AND end_time = :end_time\n                            AND weekday = :weekday\n                    ");
                 $statement->execute(array('course_id' => $object->getId(), 'start_time' => $matches[2] . ":" . $matches[3] . ":00", 'end_time' => $matches[4] . ":" . $matches[5] . ":00", 'weekday' => $weekdays[$day]));
                 $found = false;
                 foreach ($statement->fetchAll(PDO::FETCH_COLUMN) as $cycle_id) {
                     if (FleximportMappedItem::findbyItemId($cycle_id, $import_type_metadates)) {
                         $found = $cycle_id;
                         break;
                     }
                 }
                 if (!$found) {
                     /*$semester = $object->end_semester;
                       $cycle = new SeminarCycleDate(); //Does not work yet
                       $cycle['seminar_id'] = $object->getId();
                       $cycle->start_hour = $matches[2];
                       $cycle->start_minute = $matches[3];
                       $cycle->end_hour = $matches[4];
                       $cycle->end_minute = $matches[5];
                       $cycle['weekday'] = $weekdays[$day];
                       $cycle['week_offset'] = 0;
                       $cycle['end_offset'] = floor(($semester->ende - $semester->beginn) / (7*24*60*60)) - 2;
                       $cycle['cycle'] = 0; //wöchentlich
                       $cycle->store();
                       $cycle_id = $cycle->getId();*/
                     $seminar = new Seminar($object->getId());
                     $cycle_id = $seminar->addCycle(array('day' => $weekdays[$day], 'start_stunde' => $matches[2], 'start_minute' => $matches[3], 'end_stunde' => $matches[4], 'end_minute' => $matches[5], 'week_offset' => 0, 'startWeek' => 0, 'turnus' => 0));
                     $mapped = new FleximportMappedItem();
                     $mapped['table_id'] = $import_type_metadates;
                     $mapped['item_id'] = $cycle_id;
                     $mapped->store();
                     $metadates[] = $cycle_id;
                 } else {
                     $seminar = new Seminar($object->getId());
                     $seminar->editCycle(array('cycle_id' => $found, 'day' => $weekdays[$day], 'start_stunde' => $matches[2], 'start_minute' => $matches[3], 'end_stunde' => $matches[4], 'end_minute' => $matches[5], 'week_offset' => 0, 'startWeek' => 0, 'turnus' => 0));
                     /*$semester = $object->end_semester;
                       $cycle = new SeminarCycleDate($found);
                       $cycle['seminar_id'] = $object->getId();
                       $cycle->start_hour = $matches[2];
                       $cycle->start_minute = $matches[3];
                       $cycle->end_hour = $matches[4];
                       $cycle->end_minute = $matches[5];
                       $cycle['weekday'] = $weekdays[$day];
                       $cycle['cycle'] = 0; //wöchentlich
                       $cycle['week_offset'] = 0;
                       $cycle['end_offset'] = floor(($semester->ende - $semester->beginn) / (7*24*60*60)) - 2;
                       $cycle->store();*/
                     $metadates[] = $found;
                 }
             }
         } else {
             //$zeit = explode("-", $zeit);
             preg_match("/(\\d{4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2})\\s*-\\s(\\d{4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2})/", $zeit, $matches);
             $begin = strtotime($matches[1]);
             $end = strtotime($matches[2]);
             $found = false;
             $dates = CourseDate::findBySQL("range_id = :course_id AND date = :begin AND end_time = :end", array('course_id' => $object->getId(), 'begin' => $begin, 'end' => $end));
             foreach ($dates as $date) {
                 if (FleximportMappedItem::findbyItemId($date->getId(), $import_type_dates)) {
                     $found = true;
                     $singledates[] = $date->getId();
                     break;
                 }
             }
             if (!$found) {
                 $date = new CourseDate();
                 $date['range_id'] = $object->getId();
                 $date['date'] = $begin;
                 $date['end_time'] = $end;
                 $date->store();
                 $mapped = new FleximportMappedItem();
                 $mapped['table_id'] = $import_type_dates;
                 $mapped['item_id'] = $date->getId();
                 $mapped->store();
                 $singledates[] = $date->getId();
             }
         }
     }
     $items = FleximportMappedItem::findBySQL("table_id = :table_id AND item_id NOT IN (:ids)", array('table_id' => $import_type_dates, 'ids' => $singledates ?: ""));
     foreach ($items as $item) {
         $date = new CourseDate($item['item_id']);
         $date->delete();
         $item->delete();
     }
     $items = FleximportMappedItem::findBySQL("table_id = :table_id AND item_id NOT IN (:ids)", array('table_id' => $import_type_metadates, 'ids' => $metadates ?: ""));
//.........这里部分代码省略.........
开发者ID:Krassmus,项目名称:Fleximport,代码行数:101,代码来源:fleximport_karlsruhe_courses.php


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