public function searchShow($id)
 {
     $tutorial = Tutorial::find($id);
     $qa = Qa::find($id);
     if ($tutorial) {
         return Redirect::action('TutorialsController@show', $tutorial->id);
     }
     if ($qa) {
         return Redirect::action('QasController@show', $qa->id);
     }
 }
 public function run()
 {
     $faker = Faker::create();
     $users = User::all();
     $qa = Qa::firstOrFail();
     $tutorial = Tutorial::firstOrFail();
     foreach (range(1, 50) as $index) {
         $user = $users->random();
         Comment::create(['content' => $faker->sentence, 'user_id' => $user->id, 'qa_id' => $qa->id]);
     }
     foreach (range(1, 50) as $index) {
         $user = $users->random();
         Comment::create(['content' => $faker->sentence, 'user_id' => $user->id, 'tutorial_id' => $tutorial->id]);
     }
 }
 public function run()
 {
     $tutorials = Tutorial::all();
     $tags = Tag::lists('id');
     $last = count($tags) - 1;
     foreach ($tutorials as $tutorial) {
         $tutorial->tags()->attach($tags[rand(0, $last)]);
     }
     foreach ($tutorials as $tutorial) {
         $tutorial->tags()->attach($tags[rand(0, $last)]);
     }
     foreach ($tutorials as $tutorial) {
         $tutorial->tags()->attach($tags[rand(0, $last)]);
     }
 }
 /**
  * Return all Tutorials
  */
 public function actionIndex()
 {
     $response = array();
     $response['VideoPath'] = Yii::app()->params['siteDomain'] . Yii::app()->params['videoPath'];
     $response['Entries'] = array();
     $tutorials = Tutorial::model()->findAll();
     if ($tutorials != null) {
         // Have something to return..
         // Get images for each entry.
         foreach ($tutorials as $tutorial) {
             // Get all images for current tutorial entry.
             $response['Entries'][] = array('Id' => $tutorial->Id, 'Name' => $tutorial->Name, 'Description' => $tutorial->Description, 'VideoName' => $tutorial->VideoName);
         }
     }
     $this->sendResponse(200, CJSON::encode($response));
 }
 public function run()
 {
     $users = User::all();
     $faker = Faker::create();
     $title = ["Changing your oil in 12 simple steps.", "Checking your tire pressure.", "Popping the hood: a lesson for beginners.", "How to put snow chains on your tires.", "How to lose friends and alienate people.", "The Art and Zen of light automobile maintenance.", "How to replace your transmission in 7 easy steps!"];
     $image = ["/uploaded/thumb_IMG_1922_1024.jpg", "/uploaded/thumb_IMG_1923_1024.jpg", "/uploaded/thumb_IMG_1924_1024.jpg", "/uploaded/thumb_IMG_1925_1024.jpg", "/uploaded/thumb_IMG_1926_1024.jpg", "/uploaded/thumb_IMG_1927_1024.jpg", "/uploaded/thumb_IMG_1928_1024.jpg", "/uploaded/thumb_IMG_1929_1024.jpg", "/uploaded/thumb_IMG_1930_1024.jpg", "/uploaded/thumb_IMG_1931_1024.jpg", "/uploaded/Altima.jpg", null];
     $video = ["/uploaded/traffic.mov", "/uploaded/check_oil-web.mov", "/uploaded/Untitled.ogg", null];
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
     foreach (range(1, 5) as $index) {
         $user = $users->random();
         Tutorial::create(['title' => $title[array_rand($title, 1)], 'content' => "What's the meaning of this. Good. Have a good trip Einstein, watch your head. So tell me, future boy, who's president of the United States in 1985? Let me show you my plan for sending you home. Please excuse the crudity of this model, I didn't have time to build it to scale or to paint it. Good evening, I'm Doctor Emmett Brown. I'm standing on the parking lot of Twin Pines Mall. It's Saturday morning, October 26, 1985, 1:18 a.m. and this is temporal experiment number one. C'mon, Einy, hey hey boy, get in there, that a boy, in you go, get down, that's it.\n\t\t\t\t\t\tThat was the day I invented time travel. I remember it vividly. I was standing on the edge of my toilet hanging a clock, the porces was wet, I slipped, hit my head on the edge of the sink. And when I came to I had a revelation, a picture, a picture in my head, a picture of this. This is what makes time travel possible. The flux capacitor. Now remember, according to my theory you interfered with with your parent's first meeting. They don't meet, they don't fall in love, they won't get married and they wont have kids. That's why your older brother's disappeared from that photograph. Your sister will follow and unless you repair the damages, you will be next. Great Scott. Let me see that photograph again of your brother. Just as I thought, this proves my theory, look at your brother. One point twenty-one gigawatts. One point twenty-one gigawatts. Great Scott. Thank you. In about thirty years.\n\t\t\t\t\t\tGood, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall. My god, they found me. I don't know how but they found me. Run for it, Marty. My god, they found me. I don't know how but they found me. Run for it, Marty. Oh, great scott. You get the cable, I'll throw the rope down to you. No, Marty, we've already agreed that having information about the future could be extremely dangerous. Even if your intentions are good, they could backfire drastically. Whatever you've got to tell me I'll find out through the natural course of time. About 30 years, it's a nice round number.", 'description' => $faker->sentence, 'image' => $image[array_rand($image, 1)], 'video' => $video[array_rand($video, 1)], 'user_id' => $user->id]);
     }
 }
Example #6
0
 /**
  * Returns the number of tutorials for the current page
  *
  * @return int
  */
 public function numberOfTutorials()
 {
     if (!$this->isAdmin()) {
         return 0;
     }
     $tutorial = new Tutorial();
     $unseen = $tutorial->getUnseen();
     if ($unseen === false) {
         return 0;
     }
     return count($unseen);
 }
Example #7
0
 protected function loadTutorial($tutId)
 {
     if ($this->_tutorial === null) {
         $this->_tutorial = Tutorial::model()->findByPk($tutId);
         if ($this->_tutorial === null) {
             throw new CHttpException(404, 'The requested Tutorial does not exists');
         }
     }
     return $this->_tutorial;
 }
 /**
  *
  * @param usersData $data
  * @return type 
  */
 public function updateTutorial($data)
 {
     $userModel = new Users();
     $tutorialModel = new Tutorial();
     $user = $userModel->getUserById($data->id);
     $tutorialId = $user->attributes['tutorial_id'];
     $tutorialModel->unsetAttributes();
     $result = $tutorialModel->updateByPk($tutorialId, $data->tutorials);
     $body = $this->renderPartial('tutorial/result', array('format' => $data->format, 'result' => $result), true);
     return $this->response->type('json')->goodResponse($body);
 }
Example #9
0
    case LOGOUT:
        page_finish('logout');
        exit;
        break;
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    default:
        $template->throwError("Modus " . $modus . "ist nicht verfügbar. CaveID :" . $caveID);
        break;
}
// init tutorial
$tutorial = new Tutorial();
$tutorialFinish = $tutorial->checkFinish($ownCaves[$caveID]);
if (!$tutorial->noTutorial) {
    $finish = Request::getVar('tutorial', '');
    if ($tutorialFinish && $finish == 'finish' && Request::isPost('postConfirm')) {
        $tutorial->setFinish($ownCaves[$caveID]);
        $tutorialFinish = $tutorial->checkFinish($ownCaves[$caveID]);
    }
    $template->addVar('tutorial', array('show' => true, 'content' => $tutorial->msg, 'finish' => $tutorialFinish, 'open' => $tutorialFinish || $finish == 'finish' ? 'true' : 'false'));
} else {
    $template->addVar('tutorial', array('show' => false));
}
// prepare resource bar
$resources = array();
if ($template->getShowResource() && isset($resourceTypeList)) {
    foreach ($resourceTypeList as $resource) {
Example #10
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Tutorial::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function vote($id)
 {
     $tutorial = Tutorial::findOrFail($id);
     // +1 or -1
     $voteValue = Input::get('vote');
     $vote = Vote::firstOrNew(['user_id' => Auth::id(), 'voteable_id' => $id, 'voteable_type' => 'Tutorial']);
     $vote->vote = $voteValue;
     $vote->save();
     return Redirect::back();
 }