This class has been auto-generated by the Doctrine ORM Framework
Author: Tom Doggett
Inheritance: extends BaseEpisode
Ejemplo n.º 1
0
 /**
  * @param $segmentTime
  * @param Episode $episode
  * @return bool
  */
 public static function isSegmentWithinEpisodeBounds($segmentTime, $episode)
 {
     $segmentDateTime = null;
     if ($segmentTime instanceof DateTime) {
         $segmentDateTime = $segmentTime;
     } else {
         $segmentDateTime = new DateTime("January 1, " . $segmentTime);
     }
     $segmentStartTimeInMinutes = self::getTimeInMinutesSinceMidnight($segmentDateTime);
     $episodeStartTime = $episode->getStartTime();
     $episodeStartTimeInMinutes = self::getTimeInMinutesSinceMidnight($episodeStartTime);
     $episodeStartDay = $episodeStartTime->format('N');
     $episodeEndTime = $episode->getEndTime();
     $episodeEndTimeInMinutes = self::getTimeInMinutesSinceMidnight($episodeEndTime);
     $episodeEndDay = $episodeEndTime->format('N');
     if ($episodeStartDay === $episodeEndDay) {
         if ($segmentStartTimeInMinutes >= $episodeStartTimeInMinutes && $segmentStartTimeInMinutes <= $episodeEndTimeInMinutes) {
             return true;
         }
     } else {
         if ($segmentStartTimeInMinutes + MINUTES_IN_DAY >= $episodeStartTimeInMinutes && $segmentStartTimeInMinutes <= $episodeEndTimeInMinutes || $segmentStartTimeInMinutes >= $episodeStartTimeInMinutes && $segmentStartTimeInMinutes <= $episodeEndTimeInMinutes + MINUTES_IN_DAY) {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 public function getEpisodeBySeriesName($sSeriesName, $iSeason = SEASON_DEFAULT, $iEpisode = EPISODE_DEFAULT)
 {
     $sFinalURL = $this->_sOMDBAPIRoot . "?t=" . urlencode($sSeriesName) . "&Season=" . $iSeason . "&Episode=" . $iEpisode . "&plot=full";
     $sJSON = $this->accessURL($sFinalURL);
     $oEpisode = new Episode();
     $oEpisode->loadFromJSON($sJSON);
 }
Ejemplo n.º 3
0
 /**
  * gets all the events in the episode for the event type this API is for, for the given patient, most recent first.
  *
  * @param Patient $patient - the patient
  * @param Episode $episode - the episode
  *
  * @return array - list of events of the type for this API instance
  */
 public function getEventsInEpisode($patient, $episode)
 {
     $event_type = $this->getEventType();
     if ($episode) {
         return $episode->getAllEventsByType($event_type->id);
     }
     return array();
 }
 /**
  * Tests saving a sfGuardUserSubredditMembership that identifies a User as
  * "blocked" for a particular Subreddit.  When this occurs, all existing
  * future EpisodeAssignments should be deleted because blocked users cannot
  * participate with the Subreddit.
  */
 public function testSavingBlockedUser()
 {
     // Establish fake Subreddit
     $subreddit = new Subreddit();
     $subreddit->setName(rand(0, 1000));
     $subreddit->setDomain(rand(0, 1000));
     $subreddit->save();
     // Establish User
     $user = new sfGuardUser();
     $user->setEmailAddress(rand(0, 100000));
     $user->setUsername(rand(0, 10000));
     $user->setIsValidated(1);
     $user->save();
     $user_id = $user->getIncremented();
     $this->assertNotEquals(0, $user_id);
     // Establish Episode for Subreddit
     $episode = new Episode();
     $episode->setSubreddit($subreddit);
     $episode->setReleaseDate(date('Y-m-d H:i:s', time() + 34000));
     $episode->save();
     $author_type = AuthorTypeTable::getInstance()->findOneBy('type', 'squid');
     $deadline = new Deadline();
     $deadline->setSubreddit($subreddit);
     $deadline->setAuthorType($author_type);
     $deadline->setSeconds(0);
     $deadline->save();
     $episode_assignment = new EpisodeAssignment();
     $episode_assignment->setSfGuardUser($user);
     $episode_assignment->setEpisode($episode);
     $episode_assignment->setAuthorType($author_type);
     $episode_assignment->save();
     $number_of_episodes = EpisodeAssignmentTable::getInstance()->createQuery()->select('COUNT(EpisodeAssignment.id)')->leftJoin('Episode')->where('subreddit_id = ?', $subreddit->getIncremented())->andWhere('EpisodeAssignment.sf_guard_user_id = ?', $user_id)->andWhere('Episode.release_date > NOW()')->groupBy('EpisodeAssignment.id')->count();
     $this->assertEquals(1, $number_of_episodes);
     // Establish User Membership as Blocked
     $blocked = MembershipTable::getInstance()->findOneBy('type', 'blocked');
     $user_membership = new sfGuardUserSubredditMembership();
     $user_membership->setSubreddit($subreddit);
     $user_membership->setSfGuardUser($user);
     $user_membership->setMembership($blocked);
     // Save Membership
     $user_membership->save();
     // Asert that User has zero Episodes
     $number_of_episodes = EpisodeAssignmentTable::getInstance()->createQuery()->select('COUNT(EpisodeAssignment.id)')->leftJoin('Episode')->where('subreddit_id = ?', $subreddit->getIncremented())->andWhere('EpisodeAssignment.sf_guard_user_id = ?', $user_id)->andWhere('Episode.release_date > NOW()')->groupBy('EpisodeAssignment.id');
     $sql = $number_of_episodes->getSqlQuery();
     $number_of_episodes = $number_of_episodes->count();
     $this->assertTrue(0 == $number_of_episodes, $sql . "\n" . $subreddit->getIncremented() . "\n" . $user_id);
     // Remove User Membership
     $user_membership->delete();
     // Delete User
     $user->delete();
     // Delete Episode
     $episode->delete();
     // Delete Deadline
     $deadline->delete();
     // Delete Subreddit
     $subreddit->delete();
 }
Ejemplo n.º 5
0
 public function getEpisodesdata()
 {
     $episodes = array();
     foreach ($this->_data['episodes'] as $data) {
         $episodesob = new Episode($data, $this->getTVShowID());
         $episodes[] = $episodesob->get_data();
     }
     return $episodes;
 }
Ejemplo n.º 6
0
 /**
  * @param Firm    $firm
  * @param Episode $episode
  *
  * @return bool
  */
 public function canEditEpisode(Firm $firm, Episode $episode)
 {
     if ($episode->legacy) {
         return false;
     }
     if ($episode->support_services) {
         return $firm->isSupportServicesFirm();
     }
     return $firm->getSubspecialtyID() === $episode->getSubspecialtyID();
 }
Ejemplo n.º 7
0
 public function RecordDownload(Episode $episode)
 {
     $episode->Insert();
     $show = $episode->show();
     // If this is the next episode, update the |last_episode|.
     if ($episode->season == $show->last_season && $episode->episode - 1 == $show->last_episode) {
         $episode->show()->last_episode = $episode->episode;
         $episode->show()->Update();
     }
 }
Ejemplo n.º 8
0
 public function find_or_create_by_post_id($post_id)
 {
     $episode = Episode::find_one_by_property('post_id', $post_id);
     if ($episode) {
         return $episode;
     }
     $episode = new Episode();
     $episode->post_id = $post_id;
     $episode->save();
     return $episode;
 }
Ejemplo n.º 9
0
Archivo: show.php Proyecto: rsesek/nztv
 public function GetLatestEpisode()
 {
     $query = self::db()->Prepare("\n      SELECT nzbid FROM downloads\n      WHERE show_id = ?\n      ORDER BY season DESC, episode DESC\n      LIMIT 1\n    ");
     $query->Execute(array($this->show_id));
     $data = $query->FetchObject();
     if (!$data) {
         return NULL;
     }
     $episode = new Episode(array('nzbid' => $data->nzbid));
     $episode->FetchInto();
     return $episode;
 }
Ejemplo n.º 10
0
 /**
  * Returns the information about a show including episodes and watched, 
  * owned data for a user.
  */
 function get_show_with_episode_user($show_id, $season, $user_id)
 {
     // Setup query parameters
     $params = array('contain' => FALSE, 'conditions' => array('OR' => array(array('Show.id =' => $show_id), array('Show.name =' => $show_id))));
     // Perform query
     $show_info = $this->cache('first', $params);
     // Grab the episodes
     App::import('Model', 'Episode');
     $episode = new Episode();
     $show_info['Episode'] = $episode->get_episodes_with_user($show_info['Show']['id'], $season, $user_id);
     return $show_info;
 }
Ejemplo n.º 11
0
 public function IsAlreadyDownloaded()
 {
     $ep = new Episode();
     $ep->set_condition('show_id = :show_id AND season = :season AND episode = :episode');
     $ep->show_id = $this->show()->show_id;
     $ep->season = $this->season;
     $ep->episode = $this->episode;
     try {
         $result = $ep->Fetch();
         return $result != NULL;
     } catch (\phalanx\data\ModelException $e) {
         return FALSE;
     }
 }
 /**
  * @param PDO $dbConn
  * @param Episode $episodeObject
  * @return null
  */
 public static function saveNewEpisode($dbConn, $episodeObject)
 {
     $startDateTimeObject = formatDateStringForDatabaseWrite($episodeObject->getStartTime());
     $endDateTimeObject = formatDateStringForDatabaseWrite($episodeObject->getEndTime());
     $columnNames = array(self::PLAYLIST_COLUMN_NAME, self::PROGRAM_COLUMN_NAME, self::PROGRAMMER_COLUMN_NAME, self::START_TIME_COLUMN_NAME, self::END_TIME_COLUMN_NAME, self::IS_PRERECORD_COLUMN_NAME, self::PRERECORD_COLUMN_NAME, self::IS_DRAFT_COLUMN_NAME);
     $values = array($episodeObject->getPlaylist()->getId(), $episodeObject->getProgram()->getId(), $episodeObject->getProgrammer()->getId(), $startDateTimeObject, $endDateTimeObject, $episodeObject->isPrerecord(), $episodeObject->getPrerecordDate(), true);
     return writeToDatabase::writeEntryToDatabase($dbConn, self::TABLE_NAME, $columnNames, $values);
 }
 /**
  * Caching wrapper for the current episode lookup
  *
  * @return array|mixed|null|void
  * @throws Exception
  */
 public function getOwnerCurrentEpisode()
 {
     if (!$this->current_episode) {
         $this->current_episode = Episode::getCurrentEpisodeByFirm($this->owner->patient->id, $this->owner->firm);
     }
     return $this->current_episode;
 }
Ejemplo n.º 14
0
 public function getAll()
 {
     $lessons = Lesson::all();
     $episodes = Episode::all();
     $lessons = $lessons->toBase()->merge($episodes);
     return $lessons;
 }
Ejemplo n.º 15
0
 public function get($season, $episode)
 {
     $episode = Episode::with(['doctors', 'companions', 'enemies'])->where('season', $season)->where('episode', $episode)->first();
     $ratings = Rating::getRating('episode', $episode->id);
     $comments = Comment::where('item_id', $episode->id)->where('item_type', 'episode')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.episode', ['episode' => $episode, 'ratings' => $ratings, 'comments' => $comments]);
 }
Ejemplo n.º 16
0
 public function index()
 {
     $doctors = Doctor::take(4)->orderBy('number')->get();
     $companions = Companion::take(4)->get();
     $enemies = Enemy::take(4)->get();
     $episodes = Episode::take(4)->get();
     return View::make('index', ['doctors' => $doctors, 'companions' => $companions, 'enemies' => $enemies, 'episodes' => $episodes]);
 }
 public function findAll($attributes = '', $values = array())
 {
     // because we are working with a view, we should present the event as the last Biometry from the view
     // we need the patient ID and the last_modified date of the current event
     // $attributes == "event_id = ?" in this case
     $eventData = Event::model()->findByPk($values[0]);
     $episodeData = Episode::model()->findByPk($eventData->episode_id);
     $latestData = $this->findAllBySql("\n\t\t\t\t\t\tSELECT eob.*, '" . $values[0] . "' AS event_id FROM et_ophtroperationnote_biometry eob\n\t\t\t\t\t\t\t\t\t\tWHERE eob.patient_id=" . $episodeData->patient_id . "\n\t\t\t\t\t\t\t\t\t\tAND eob.last_modified_date <= '" . $eventData->last_modified_date . "'\n\t\t\t\t\t\t\t\t\t\tORDER BY eob.last_modified_date\n\t\t\t\t\t\t\t\t\t\tDESC LIMIT 1; ");
     return $latestData;
 }
 /**
  * Collate the data and persist it to the table.
  *
  * @param $id
  *
  * @throws CHttpException
  * @throws Exception
  */
 public function loadData($id)
 {
     $booking = Element_OphTrOperationbooking_Operation::model()->find('event_id=?', array($id));
     $eye = Eye::model()->findByPk($booking->eye_id);
     if ($eye->name === 'Both') {
         throw new CHttpException(400, 'Can\'t display whiteboard for dual eye bookings');
     }
     $eyeLabel = strtolower($eye->name);
     $event = Event::model()->findByPk($id);
     $episode = Episode::model()->findByPk($event->episode_id);
     $patient = Patient::model()->findByPk($episode->patient_id);
     $contact = Contact::model()->findByPk($patient->contact_id);
     $biometryCriteria = new CDbCriteria();
     $biometryCriteria->addCondition('patient_id = :patient_id');
     $biometryCriteria->params = array('patient_id' => $patient->id);
     $biometryCriteria->order = 'last_modified_date DESC';
     $biometryCriteria->limit = 1;
     $biometry = Element_OphTrOperationnote_Biometry::model()->find($biometryCriteria);
     $examination = $event->getPreviousInEpisode(EventType::model()->findByAttributes(array('name' => 'Examination'))->id);
     //$management = new \OEModule\OphCiExamination\models\Element_OphCiExamination_Management();
     //$anterior = new \OEModule\OphCiExamination\models\Element_OphCiExamination_AnteriorSegment();
     $risks = new \OEModule\OphCiExamination\models\Element_OphCiExamination_HistoryRisk();
     if ($examination) {
         //$management = $management->findByAttributes(array('event_id' => $examination->id));
         //$anterior = $anterior->findByAttributes(array('event_id' => $examination->id));
         $risks = $risks->findByAttributes(array('event_id' => $examination->id));
     }
     $labResult = Element_OphInLabResults_Inr::model()->findPatientResultByType($patient->id, '1');
     $allergies = Yii::app()->db->createCommand()->select('a.name as name')->from('patient_allergy_assignment pas')->leftJoin('allergy a', 'pas.allergy_id = a.id')->where("pas.patient_id = {$episode->patient_id}")->order('a.name')->queryAll();
     $allergyString = 'None';
     if ($allergies) {
         $allergyString = implode(',', array_column($allergies, 'name'));
     }
     $operation = Yii::app()->db->createCommand()->select('proc.term as term')->from('et_ophtroperationbooking_operation op')->leftJoin('ophtroperationbooking_operation_procedures_procedures opp', 'opp.element_id = op.id')->leftJoin('proc', 'opp.proc_id = proc.id')->where("op.event_id = {$id}")->queryAll();
     $this->event_id = $id;
     $this->booking = $booking;
     $this->eye_id = $eye->id;
     $this->eye = $eye;
     $this->predicted_additional_equipment = $booking->special_equipment_details;
     $this->comments = '';
     $this->patient_name = $contact['title'] . ' ' . $contact['first_name'] . ' ' . $contact['last_name'];
     $this->date_of_birth = $patient['dob'];
     $this->hos_num = $patient['hos_num'];
     $this->procedure = implode(',', array_column($operation, 'term'));
     $this->allergies = $allergyString;
     $this->iol_model = $biometry ? $biometry->attributes['lens_description_' . $eyeLabel] : 'Unknown';
     $this->iol_power = $biometry ? $biometry->attributes['iol_power_' . $eyeLabel] : 'none';
     $this->predicted_refractive_outcome = $biometry ? $biometry->attributes['predicted_refraction_' . $eyeLabel] : 'Unknown';
     $this->alpha_blockers = $patient->hasRisk('Alpha blockers');
     $this->anticoagulants = $patient->hasRisk('Anticoagulants');
     $this->alpha_blocker_name = $risks ? $risks->alpha_blocker_name : '';
     $this->anticoagulant_name = $risks ? $risks->anticoagulant_name : '';
     $this->inr = $labResult ? $labResult : 'None';
     $this->save();
 }
Ejemplo n.º 19
0
 /**
  * Tests whether we can grab an Episode that is due to be released within a
  * specified length of time from now.
  */
 public function testGetOneEpisodeReleasedWithinSeconds()
 {
     // Create Test Subreddit
     $subreddit = new Subreddit();
     $subreddit->setName(rand(0, 1000));
     $subreddit->setDomain(rand(0, 1000));
     $subreddit->save();
     // Create Test Episode
     $episode = new Episode();
     $episode->setReleaseDate(date('Y-m-d H:i:s', time() + 100));
     $episode->setSubreddit($subreddit);
     $episode->save();
     $another_episode = new Episode();
     $another_episode->setReleaseDate(date('Y-m-d H:i:s', time() + 500));
     $another_episode->setSubreddit($subreddit);
     $another_episode->save();
     $seconds_within = 200;
     // Run table query to grab episode without ID
     $random_episode = EpisodeTable::getInstance()->getOneEpisodeReleasedWithinSeconds($seconds_within);
     $this->assertTrue($random_episode instanceof Episode);
     // Run table query to grab episode WITH ID
     $random_episode = EpisodeTable::getInstance()->getOneEpisodeReleasedWithinSeconds($seconds_within, $episode->getIncremented());
     $this->assertTrue($random_episode instanceof Episode);
     // Run table query to grab anotherepisode WITH ID
     $random_episode = EpisodeTable::getInstance()->getOneEpisodeReleasedWithinSeconds($seconds_within, $another_episode->getIncremented());
     $this->assertFalse($random_episode instanceof Episode);
     // Delete episodes
     $another_episode->delete();
     $episode->delete();
     // Delete subreddit.
     $subreddit->delete();
 }
Ejemplo n.º 20
0
 public function run()
 {
     DB::table('ratings')->delete();
     // Going to randomize all our ratings for our users, so throw everything in
     // an array.
     $toRate = array(array('item' => Doctor::where('number', 9)->first(), 'type' => 'doctor'), array('item' => Doctor::where('number', 10)->first(), 'type' => 'doctor'), array('item' => Doctor::where('number', 11)->first(), 'type' => 'doctor'), array('item' => Doctor::where('number', 12)->first(), 'type' => 'doctor'), array('item' => Enemy::where('name', 'Cybermen')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'Daleks')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'Sontarans')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'The Silence')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'Weeping Angels')->first(), 'type' => 'enemy'), array('item' => Companion::where('name', 'Amy Pond')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Captain Jack')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Clara Oswald')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Donna Noble')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Martha Jones')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Mickey Smith')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'River Song')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Rory Williams')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Rose Tyler')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Wilfred Mott')->first(), 'type' => 'companion'), array('item' => Episode::where('season', 1)->where('episode', 1)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 1)->where('episode', 6)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 1)->where('episode', 10)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 1)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 2)->where('episode', 5)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 2)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 3)->where('episode', 9)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 3)->where('episode', 10)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 4)->where('episode', 4)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 4)->where('episode', 13)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 5)->where('episode', 3)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 5)->where('episode', 4)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 5)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 6)->where('episode', 1)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 6)->where('episode', 10)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 6)->where('episode', 13)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 7)->where('episode', 5)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 7)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 8)->where('episode', 2)->first(), 'type' => 'episode'));
     $users = User::get();
     // Loop through our users
     foreach ($users as $user) {
         // Loop through things to be rated
         foreach ($toRate as $item) {
             $rating = rand(1, 5);
             Rating::create(array('user_id' => $user->id, 'item_id' => $item['item']->id, 'item_type' => $item['type'], 'rating' => $rating));
         }
     }
 }
Ejemplo n.º 21
0
 public function run()
 {
     if ($this->element) {
         $this->class = CHTML::modelName($this->element);
     } else {
         $this->class = get_class($this);
     }
     if (empty($_POST) || !array_key_exists($this->class, $_POST)) {
         if (empty($this->element->event_id)) {
             if ($this->default) {
                 // It's a new event so fetch the most recent element_diagnosis
                 $firmId = Yii::app()->session['selected_firm_id'];
                 $firm = Firm::model()->findByPk($firmId);
                 if (isset(Yii::app()->getController()->patient)) {
                     $patientId = Yii::app()->getController()->patient->id;
                     $episode = Episode::getCurrentEpisodeByFirm($patientId, $firm, true);
                     if ($episode && ($disorder = $episode->diagnosis)) {
                         // There is a diagnosis for this episode
                         $this->value = $disorder->id;
                         $this->label = $disorder->term;
                     }
                 }
             }
         } else {
             if (isset($this->element->disorder)) {
                 $this->value = $this->element->disorder->id;
                 $this->label = $this->element->disorder->term;
             }
         }
     } elseif (array_key_exists($this->field, $_POST[$this->class])) {
         if (preg_match('/[^\\d]/', $_POST[$this->class][$this->field])) {
             if ($disorder = Disorder::model()->find('term=? and specialty_id is not null', array($_POST[$this->class][$this->field]))) {
                 $this->value = $disorder->id;
                 $this->label = $disorder->term;
             }
         } else {
             $this->value = $_POST[$this->class][$this->field];
             if ($disorder = Disorder::model()->findByPk($this->value)) {
                 $this->label = $disorder->term;
             }
         }
     }
     parent::run();
 }
Ejemplo n.º 22
0
 public function run()
 {
     DB::table('comments')->delete();
     // Going to randomize all our ratings for our users, so throw everything in
     // an array.
     $toComment = array(array('item' => Doctor::where('number', 9)->first(), 'type' => 'doctor'), array('item' => Doctor::where('number', 10)->first(), 'type' => 'doctor'), array('item' => Doctor::where('number', 11)->first(), 'type' => 'doctor'), array('item' => Doctor::where('number', 12)->first(), 'type' => 'doctor'), array('item' => Enemy::where('name', 'Cybermen')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'Daleks')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'Sontarans')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'The Silence')->first(), 'type' => 'enemy'), array('item' => Enemy::where('name', 'Weeping Angels')->first(), 'type' => 'enemy'), array('item' => Companion::where('name', 'Amy Pond')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Captain Jack')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Clara Oswald')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Donna Noble')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Martha Jones')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Mickey Smith')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'River Song')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Rory Williams')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Rose Tyler')->first(), 'type' => 'companion'), array('item' => Companion::where('name', 'Wilfred Mott')->first(), 'type' => 'companion'), array('item' => Episode::where('season', 1)->where('episode', 1)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 1)->where('episode', 6)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 1)->where('episode', 10)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 1)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 2)->where('episode', 5)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 2)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 3)->where('episode', 9)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 3)->where('episode', 10)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 4)->where('episode', 4)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 4)->where('episode', 13)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 5)->where('episode', 3)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 5)->where('episode', 4)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 5)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 6)->where('episode', 1)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 6)->where('episode', 10)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 6)->where('episode', 13)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 7)->where('episode', 5)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 7)->where('episode', 12)->first(), 'type' => 'episode'), array('item' => Episode::where('season', 8)->where('episode', 2)->first(), 'type' => 'episode'));
     $titles = array('Fabulous!', 'My favorite!', 'This stank more than anything has stunk before', 'This one put me to sleep', 'Stay away', 'Not impressed', 'Vote for Pedro', 'Cheap Wristwatch', 'I hope to see this again', 'Blew my mind', 'Ripoff', 'The old one was better', 'Better than ever');
     $comments = array("It's time to play the music. It's time to light the lights. It's time to meet the Muppets on the Muppet Show tonight. Movin' on up to the east side. We finally got a piece of the pie. Doin' it our way. There's nothing we wont try. Never heard the word impossible. This time there's no stopping us. The first mate and his Skipper too will do their very best to make the others comfortable in their tropic island nest. I have always wanted to have a neighbor just like you. I've always wanted to live in a neighborhood with you. Straightnin' the curves. Flatnin' the hills Someday the mountain might get ‘em but the law never will. Well the first thing you know ol' Jeds a millionaire. Kinfolk said Jed move away from there. black gold.\" Fish don't fry in the kitchen and beans don't burn on the grill. Took a whole lotta tryin' just to get up that hill.", "But they got diff'rent strokes. It takes diff'rent strokes - it takes diff'rent strokes to move the world. You wanna be where you can see our troubles are all the same. You wanna be where everybody knows Your name. Then one day he was shootin' at some food and up through the ground came a bubblin' crude. Oil that is It's time to put on makeup. It's time to dress up right. It's time to raise the curtain on the Muppet Show tonight. They were four men living all together yet they were all alone. Come and listen to a story about a man named Jed - a poor mountaineer barely kept his family fed. The year is 1987 and NASA launches the last of Americas deep space probes. The Brady Bunch the Brady Bunch that's the way we all became the Brady Bunch? It's time to put on makeup. It's time to dress up right. It's time to raise the curtain on the Muppet Show tonight. Here's the story of a lovely lady who was bringing up three very lovely girls. Here he comes Here comes Speed Racer. He's a demon on wheels!", "Fleeing from the Cylon tyranny the last Battlestar – Galactica - leads a rag-tag fugitive fleet on a lonely quest - a shining planet known as Earth. So lets make the most of this beautiful day. Since we're together The movie star the professor and Mary Ann here on Gilligans Isle. Wouldn't you like to get away? Sometimes you want to go where everybody knows your name. And they're always glad you came. We're gonna do it. On your mark get set and go now. Got a dream and we just know now we're gonna make our dream come true. Goodbye gray sky hello blue. There's nothing can hold me when I hold you. Feels so right it cant be wrong. Rockin' and rollin' all week long. Sunny Days sweepin' the clouds away. On my way to where the air is sweet. Can you tell me how to get how to get to Sesame Street? And if you threw a party - invited everyone you knew. You would see the biggest gift would be from me and the card attached would say thank you for being a friend. Well we're movin' on up to the east side. To a deluxe apartment in the sky. Knight Rider: A shadowy flight into the dangerous world of a man who does not exist. Believe it or not I'm walking on air. I never thought I could feel so free.", "Baby if you've ever wondered - wondered whatever became of me. I'm living on the air in Cincinnati. Cincinnati WKRP. Didn't need no welfare states. Everybody pulled his weight. Gee our old Lasalle ran great. Those were the days. And if you threw a party - invited everyone you knew. You would see the biggest gift would be from me and the card attached would say thank you for being a friend. Come and listen to a story about a man named Jed - a poor mountaineer barely kept his family fed! One two three four five six seven eight Sclemeel schlemazel hasenfeffer incorporated. black gold But they got diff'rent strokes. It takes diff'rent strokes - it takes diff'rent strokes to move the world.", "All of them had hair of gold like their mother the youngest one in curls! All of them had hair of gold like their mother the youngest one in curls. Believe it or not I'm walking on air. I never thought I could feel so free. Just two good ol' boys Never meanin' no harm. Beats all you've ever saw been in trouble with the law since the day they was born. The ship set ground on the shore of this uncharted desert isle with Gilligan the Skipper too the millionaire and his wife. Doin' it our way. Nothin's gonna turn us back now. Straight ahead and on the track now. We're gonna make our dreams come true. If you have a problem if no one else can help and if you can find them maybe you can hire The A-Team!", "If you have a problem if no one else can help and if you can find them maybe you can hire The A-Team. But they got diff'rent strokes. It takes diff'rent strokes - it takes diff'rent strokes to move the world. Now the world don't move to the beat of just one drum. What might be right for you may not be right for some.", "Were gonna do it. Give us any chance well take it. Give us any rule we'll break it. We're gonna make our dreams come true. Why do we always come here? I guess well never know. Its like a kind of torture to have to watch the show.", "black gold Why do we always come here? I guess well never know. Its like a kind of torture to have to watch the show. Here's the story of a lovely lady who was bringing up three very lovely girls. They were four men living all together yet they were all alone. Maybe you and me were never meant to be. But baby think of me once in awhile. I'm at WKRP in Cincinnati. The Brady Bunch the Brady Bunch that's the way we all became the Brady Bunch. Believe it or not I'm walking on air. I never thought I could feel so free. And we'll do it our way yes our way. Make all our dreams come true for me and you. Come and knock on our door. We've been waiting for you. Where the kisses are hers and hers and his. Three's company too? Texas tea., Till the one day when the lady met this fellow and they knew it was much more than a hunch. It's a beautiful day in this neighborhood a beautiful day for a neighbor. Would you be mine? Could you be mine? Its a neighborly day in this beautywood a neighborly day for a beauty. Would you be mine? Could you be mine. On the most sensational inspirational celebrational Muppetational… This is what we call the Muppet Show.", "The movie star the professor and Mary Ann here on Gilligans Isle. They're creepy and they're kooky mysterious and spooky. They're all together ooky the Addams Family. They call him Flipper Flipper faster than lightning. No one you see is smarter than he. The first mate and his Skipper too will do their very best to make the others comfortable in their tropic island nest. So get a witch's shawl on a broomstick you can crawl on. Were gonna pay a call on the Addams Family. Now the world don't move to the beat of just one drum. What might be right for you may not be right for some. Believe it or not I'm walking on air. I never thought I could feel so free. Flying away on a wing and a prayer. Who could it be? Believe it or not its just me. Doin' it our way. There's nothing we wont try. Never heard the word impossible. This time there's no stopping us.", "Movin' on up to the east side. We finally got a piece of the pie. Come and knock on our door. We've been waiting for you. Where the kisses are hers and hers and his. Three's company too. Just two good ol' boys Wouldn't change if they could. Fightin' the system like a true modern day Robin Hood. Space. The final frontier. These are the voyages of the Starship Enterprise. Doin' it our way. Nothin's gonna turn us back now. Straight ahead and on the track now. We're gonna make our dreams come true. Michael Knight a young loner on a crusade to champion the cause of the innocent. The helpless. The powerless in a world of criminals who operate above the law.", "Texas tea. I have always wanted to have a neighbor just like you. I've always wanted to live in a neighborhood with you? No phone no lights no motor car not a single luxury. Like Robinson Crusoe it's primitive as can be. black gold. And when the odds are against him and their dangers work to do. You bet your life Speed Racer he will see it through. we might as well say... Would you be mine? Could you be mine? Won't you be my neighbor. One two three four five six seven eight Sclemeel schlemazel hasenfeffer incorporated., It's time to put on makeup. It's time to dress up right. It's time to raise the curtain on the Muppet Show tonight!", "Goodbye gray sky hello blue. There's nothing can hold me when I hold you. Feels so right it cant be wrong. Rockin' and rollin' all week long. The mate was a mighty sailin' man the Skipper brave and sure. Five passengers set sail that day for a three hour tour a three hour tour.", "Knight Rider: A shadowy flight into the dangerous world of a man who does not exist. It's time to put on makeup. It's time to dress up right. It's time to raise the curtain on the Muppet Show tonight. The Brady Bunch the Brady Bunch that's the way we all became the Brady Bunch. Just two good ol' boys Wouldn't change if they could. Fightin' the system like a true modern day Robin Hood.", "So this is the tale of our castaways they're here for a long long time. They'll have to make the best of things its an uphill climb. It's time to play the music. It's time to light the lights. It's time to meet the Muppets on the Muppet Show tonight. It's time to put on makeup. It's time to dress up right. It's time to raise the curtain on the Muppet Show tonight. Here's the story of a lovely lady who was bringing up three very lovely girls. Baby if you've ever wondered - wondered whatever became of me. I'm living on the air in Cincinnati. Cincinnati WKRP.", "These days are all Happy and Free. These days are all share them with me oh baby. The ship set ground on the shore of this uncharted desert isle with Gilligan the Skipper too the millionaire and his wife. Believe it or not I'm walking on air. I never thought I could feel so free. Flying away on a wing and a prayer. Who could it be? Believe it or not its just me. Their house is a museum where people come to see ‘em. They really are a scream the Addams Family. And if you threw a party - invited everyone you knew. You would see the biggest gift would be from me and the card attached would say thank you for being a friend?\" Goodbye gray sky hello blue. There's nothing can hold me when I hold you. Feels so right it cant be wrong. Rockin' and rollin' all week long.");
     $users = User::get();
     // Loop through our users
     foreach ($users as $user) {
         // Loop through things to be rated
         foreach ($toComment as $item) {
             $title = $titles[rand(0, sizeof($titles) - 1)];
             $comment = $comments[rand(0, sizeof($comments) - 1)];
             Comment::create(array('user_id' => $user->id, 'item_id' => $item['item']->id, 'item_type' => $item['type'], 'title' => $title, 'content' => $comment));
         }
     }
 }
Ejemplo n.º 23
0
 /**
  * Find all post_ids associated with this feed.
  * 
  * @return array
  */
 function post_ids()
 {
     $episode_asset = $this->episode_asset();
     if (!$episode_asset) {
         return array();
     }
     $media_files = $episode_asset->media_files();
     if (!count($media_files)) {
         return array();
     }
     // fetch releases
     $episode_ids = array_map(function ($v) {
         return $v->episode_id;
     }, $media_files);
     $episodes = Episode::find_all_by_where("id IN (" . implode(',', $episode_ids) . ")");
     return array_map(function ($v) {
         return $v->post_id;
     }, $episodes);
 }
Ejemplo n.º 24
0
 public function create($args)
 {
     $p = PermissionHandler::getInstance();
     // do we have an error thing?
     if (!$p->allowedto(PermissionHandler::PERM_CREATE_PROJECT)) {
         Utils::error("You don't have permission to create projects.");
         return;
     }
     if (isset($_POST['go'])) {
         // ok, if the user has selected to do automatic lookup
         // of the series or automatic adding of episodes,
         // then we need to confirm that we're looking up the right
         // series.
         // scratch that. we should confirm no matter what, but if they chose
         // automatic lookup, do it here.
         $this->vars['tid'] = 0;
         $this->vars['search'] = array();
         if (!isset($_POST['confirm'])) {
             // implement automatic lookup
             // if the user wants automatic lookup, do it.
             if (isset($_POST['autolookup'])) {
                 if ($_POST['autolookup'] == "on") {
                     require_once dirname(__FILE__) . "/../plugins/animedata.php";
                     // fill in the autolookup stuff...
                     // first we need to find the anime.
                     $search = AnimeData::search($_POST['name']);
                     if ($search) {
                         if (!isset($_POST['tid'])) {
                             $tidkey = 0;
                         } else {
                             foreach ($search as $key => $entry) {
                                 if ($entry[0] == $_POST['tid']) {
                                     $tidkey = $key;
                                 }
                             }
                         }
                         $this->vars['tid'] = $search[$tidkey][0];
                         $this->vars['search'] = $search;
                         $description = AnimeData::description($search[$tidkey][0]);
                         if ($description) {
                             $_POST['description'] = $description;
                         } else {
                             Utils::warning("Could not find description.");
                         }
                         $epcount = AnimeData::epcount($search[$tidkey][0]);
                         $_POST['epsaired'] = $epcount['aired'];
                         $_POST['epstotal'] = $epcount['total'];
                         $_POST['airtime'] = $epcount['airtime'];
                     } else {
                         Utils::warning("Could not find anime.");
                     }
                 }
             }
             $this->vars['confirm'] = $_POST;
             // LOL LAZY
             // display a confirmation
             $this->view = "confirm";
             return;
         }
         // if they've already confirmed, then go ahead and create the project
         $project = new Project();
         $project->name = $_POST['name'];
         $project->shortname = $_POST['shortname'];
         $project->description = $_POST['description'];
         $project->episodes = $_POST['epstotal'];
         if ($_POST['leader'] != "none") {
             $project->leader = $_POST['leader'];
         }
         if ($_POST['template'] != "none") {
             $project->template = $_POST['template'];
             $template = Doctrine::getTable('Template')->find(0);
         }
         if (isset($_POST['tid'])) {
             $project->syoboi_id = $_POST['tid'];
         }
         $project->created = date("Y-m-d H:i:s");
         $project->save();
         if (isset($_POST['tid'])) {
             require_once dirname(__FILE__) . "/../plugins/animedata.php";
             $times = AnimeData::times($_POST['tid']);
         }
         // if the user has chosen to automatically add episodes, do so now
         if ($_POST['autoeps'] == "aired") {
             $total = $_POST['epsaired'];
         } else {
             if ($_POST['autoeps'] == "total") {
                 $total = $_POST['epstotal'];
             } else {
                 $total = 0;
             }
         }
         for ($i = 1; $i <= $total; $i++) {
             $episode = new Episode();
             $episode->project = $project->id;
             $episode->episode = $i;
             if (isset($times)) {
                 $episode->airdate = strtok($times[$i][0]['airtime'], " ");
             }
             $episode->created = date("Y-m-d H:i:s");
             $episode->save();
             if (isset($template)) {
                 $template->createTasks($episode->id);
             }
         }
         // and finally, send them to the project page.
         Utils::redirect("projects/display/" . $project->id);
         $this->view = null;
         return;
     }
     // otherwise, i don't think we actually need to do anything... right?
     // YEAH WE DO RETARD. ITS CALLED GIVE TEMPLATE SHIT.
     $q = Doctrine_Query::create()->select('s.id,s.nickname')->from('Staff s');
     $users = $q->fetchArray();
     // make this easier to use.
     foreach ($users as $row) {
         $this->vars['users'][] = array($row['id'], $row['nickname']);
     }
     $q = Doctrine_Query::create()->select('t.id, t.name')->from('Template t');
     $templates = $q->fetchArray();
     // make this easier to use.
     foreach ($templates as $row) {
         $this->vars['templates'][] = array($row['id'], $row['name']);
     }
 }
Ejemplo n.º 25
0
 /**
  * Find all post_ids associated with this feed.
  * 
  * @return array
  */
 function post_ids()
 {
     global $wpdb;
     $allowed_status = array("publish");
     $allowed_status = apply_filters("podlove_feed_post_ids_allowed_status", $allowed_status);
     $sql = "\n\t\t\tSELECT\n\t\t\t\tp.ID\n\t\t\tFROM\n\t\t\t\t" . $wpdb->posts . " p\n\t\t\t\tINNER JOIN " . Episode::table_name() . " e ON e.post_id = p.ID\n\t\t\t\tINNER JOIN " . MediaFile::table_name() . " mf ON mf.`episode_id` = e.id\n\t\t\t\tINNER JOIN " . EpisodeAsset::table_name() . " a ON a.id = mf.`episode_asset_id`\n\t\t\tWHERE\n\t\t\t\ta.id = %d\n\t\t\t\tAND\n\t\t\t\tp.post_status IN (" . implode(',', array_map(function ($s) {
         return "'{$s}'";
     }, $allowed_status)) . ")\n\t\t\tORDER BY\n\t\t\t\tp.post_date DESC\n\t\t";
     return $wpdb->get_col($wpdb->prepare($sql, $this->episode_asset()->id));
 }
Ejemplo n.º 26
0
 */
//----INCLUDE FILES----
include_once "../../digital-logsheets-res/smarty/libs/Smarty.class.php";
include_once "../../digital-logsheets-res/php/database/connectToDatabase.php";
include_once "../../digital-logsheets-res/php/database/manageCategoryEntries.php";
include_once "../../digital-logsheets-res/php/database/manageProgramEntries.php";
require_once "../../digital-logsheets-res/php/objects/logsheetClasses.php";
// create object
$smarty = new Smarty();
session_start();
//database interactions
try {
    //connect to database
    $db = connectToDatabase();
    $categories = manageCategoryEntries::getAllCategoriesFromDatabase($db);
    $programs = manageProgramEntries::getAllProgramsFromDatabase($db);
    $episodeId = $_SESSION['episodeId'];
    $episode = new Episode($db, $episodeId);
    $episodeArray = $episode->getObjectAsArray();
    //close database connection
    $db = NULL;
    $errorArray = array("segmentTimeInEpisode" => false, "firstSegmentAlignWithEpisodeStart" => false, "adNumberInteger" => false, "albumRequired" => false, "songRequired" => false, "artistRequired" => false);
    $smarty->assign("programs", $programs);
    $smarty->assign("categories", $categories);
    $smarty->assign("episode", $episodeArray);
    $smarty->assign("error", $errorArray);
    // display it
    echo $smarty->fetch('../../digital-logsheets-res/templates/add-segments.tpl');
} catch (PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}
 /**
  * Get the current episode for the firm and patient
  *
  * @return Episode
  */
 public function getEpisode()
 {
     return Episode::model()->getCurrentEpisodeByFirm($this->patient->id, $this->firm);
 }
Ejemplo n.º 28
0
                 $seriescountry[] = $r['country'];
             }
             if (!empty($r['genre'])) {
                 $seriesgenre[] = $r['genre'];
             }
             if (!empty($r['imgdata'])) {
                 $seriesimg[] = $r['imgdata'];
                 $seriesid[] = $r['id'];
             }
         }
         $rage = array('releasetitle' => array_shift($seriesnames), 'description' => array_shift($seriesdescription), 'country' => array_shift($seriescountry), 'genre' => array_shift($seriesgenre), 'imgdata' => array_shift($seriesimg), 'id' => array_shift($seriesid));
     }
 }
 $episodeArray = '';
 if ($data['episodeinfoid'] > 0) {
     $episode = new Episode();
     $episodeArray = $episode->getEpisodeInfoByID($data['episodeinfoid']);
 }
 $mov = '';
 if ($data['imdbid'] != '' && $data['imdbid'] != 00) {
     $movie = new Film();
     $mov = $movie->getMovieInfo($data['imdbid']);
     $trakt = new TraktTv();
     $traktSummary = $trakt->movieSummary('tt' . $data['imdbid'], 'full');
     if ($traktSummary !== false && isset($traktSummary['trailer']) && $traktSummary['trailer'] !== '' && preg_match('/[\\/?]v[\\/\\=](\\w+)$/i', $traktSummary['trailer'], $youtubeM)) {
         $mov['trailer'] = '<embed width="480" height="345" src="' . 'https://www.youtube.com/v/' . $youtubeM[1] . '" type="application/x-shockwave-flash"></embed>';
     } else {
         $mov['trailer'] = \newznab\utility\Utility::imdb_trailers($data['imdbid']);
     }
     if ($mov && isset($mov['title'])) {
         $mov['title'] = str_replace(array('/', '\\'), '', $mov['title']);
 public static function top_episode_ids($start, $end = "now", $limit = 3)
 {
     global $wpdb;
     $sql = "\n\t\t\tSELECT\n\t\t\t\tepisode_id, COUNT(*) downloads\n\t\t\tFROM\n\t\t\t\t" . self::table_name() . " di\n\t\t\t\tJOIN " . MediaFile::table_name() . " mf ON mf.id = di.media_file_id\n\t\t\t\tJOIN " . Episode::table_name() . " e ON e.id = mf.episode_id\n\t\t\tWHERE\n\t\t\t\t" . self::sql_condition_from_time_strings($start, $end) . "\n\t\t\tGROUP BY\n\t\t\t\tepisode_id\n\t\t\tORDER BY\n\t\t\t\tdownloads DESC\n\t\t\tLIMIT\n\t\t\t\t0, %d\n\t\t";
     return $wpdb->get_col($wpdb->prepare($sql, $limit));
 }
Ejemplo n.º 30
0
 public function save($runValidation = true, $attributes = null, $allow_overriding = false, $save_version = false)
 {
     $previous = Episode::model()->findByPk($this->id);
     if (parent::save($runValidation, $attributes, $allow_overriding, $save_version)) {
         if ($previous && $previous->episode_status_id != $this->episode_status_id) {
             $this->audit('episode', 'change-status', $this->episode_status_id);
         }
         return true;
     }
     return false;
 }