Ejemplo n.º 1
0
 public function saveSkill(Skill $skill)
 {
     try {
         $skill->save();
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
 }
Ejemplo n.º 2
0
 /**
  * User goes gym and trains
  * 
  * @return mixed (array/boolean)
  */
 public function train()
 {
     /*
     Session 1-4	100 strength gain per day
     Session 5-14	50 strength gain per day
     Session 15-34	25 strength gain per day
     Session 35-64	10 strength gain per day
     Session 65-124	5 strength gain per day
     Session 125-199	2 strength gain per day
     Session 200+	1 strength gain per day
     */
     $r = Service::getDB()->query("SELECT uid FROM `train_historial` WHERE uid = '" . $this->id . "'");
     $trainedDays = sizeof($r);
     if ($trainedDays < 5) {
         $strengh = 100;
     } elseif ($trainedDays < 15) {
         $strengh = 50;
     } elseif ($trainedDays < 35) {
         $strengh = 25;
     } elseif ($trainedDays < 65) {
         $strengh = 10;
     } elseif ($trainedDays < 125) {
         $strengh = 5;
     } elseif ($trainedDays < 200) {
         $strengh = 2;
     } else {
         $strengh = 1;
     }
     $skill = new Skill();
     $skill->get($this->id);
     $skill->strengh += $strengh;
     if ($skill->save()) {
         Service::getDB()->insert('train_historial', array('uid' => $this->id, 'date' => $this->now()));
         $trainedDays++;
         return array('strengh' => $strengh, 'trainedDays' => $trainedDays);
     } else {
         return false;
     }
 }
 protected function envSkills()
 {
     $skill = new Skill();
     $skill->skill_title = 'PHP';
     $skill->percent = '70';
     $skill->description_title = 'My Skills';
     $skill->description = 'Are Sweet';
     $skill->template_id = 1;
     $skill->save();
     $skill11 = new Skill();
     $skill11->skill_title = 'Javascript';
     $skill11->percent = '50';
     $skill11->description_title = 'My Skills';
     $skill11->description = 'Are Sweet';
     $skill11->template_id = 1;
     $skill11->save();
     $skill12 = new Skill();
     $skill12->skill_title = 'CSS';
     $skill12->percent = '50';
     $skill12->description_title = 'My Skills';
     $skill12->description = 'Are Sweet';
     $skill12->template_id = 1;
     $skill12->save();
     $skill2 = new Skill();
     $skill2->skill_title = 'PHP';
     $skill2->percent = '20';
     $skill2->description_title = 'My Skills';
     $skill2->description = 'Are Sweet';
     $skill2->template_id = 2;
     $skill2->save();
     $skill3 = new Skill();
     $skill3->skill_title = 'PHP';
     $skill3->percent = '20';
     $skill3->description_title = 'My Skills';
     $skill3->description = 'Are Sweet';
     $skill3->template_id = 3;
     $skill3->save();
 }
Ejemplo n.º 4
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param PropelPDO $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aUser !== null) {
             if ($this->aUser->isModified() || $this->aUser->isNew()) {
                 $affectedRows += $this->aUser->save($con);
             }
             $this->setUser($this->aUser);
         }
         if ($this->aSkill !== null) {
             if ($this->aSkill->isModified() || $this->aSkill->isNew()) {
                 $affectedRows += $this->aSkill->save($con);
             }
             $this->setSkill($this->aSkill);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Ejemplo n.º 5
0
     $data['skills'] = Skill::all();
     $app->render('skills/overview.html', $data);
 })->name('skills_overview');
 $app->map('/delete/:id', function ($id) use($app, $data) {
     $data['skill'] = Skill::find($id);
     if ($app->request->isPost()) {
         $data['skill']->delete();
     }
     $app->render('skills/delete.html', $data);
 })->via('GET', 'POST')->name('skills_delete');
 $app->map('/new', function () use($app, $data) {
     if ($app->request->isPost()) {
         $edu_level = EducationLevel::find($app->request->post('educationlevel'));
         $skill = new Skill();
         $skill->name = $app->request->post('title');
         $skill->save();
         $data['new_skill'] = $skill;
     }
     $app->render('skills/new.html', $data);
 })->via('GET', 'POST')->name('skills_new');
 $app->map('/edit/:id', function ($id) use($app, $data) {
     $data['request_method'] = $app->request->getMethod();
     $skill = Skill::find($id);
     if ($app->request->isGet()) {
         $data['skill'] = $skill->toArray();
     } else {
         if ($app->request->isPost()) {
             $skill->name = $app->request->post('title');
             $skill->save();
             $data['new_skill'] = $skill->toArray();
         }
Ejemplo n.º 6
0
 /**
  * Generates units from user work and pays his salary
  * 
  * @return mixed (boolean/array)
  */
 public function work()
 {
     /*
     http://wiki.e-sim.org/index.php/Productivity_formula
     * P = 10 * (4+E) * N * C * R * Q   
     P - Productivity
     E - Economy skill level
     N - Employee multiplier (Number of employees already worked that day in the company.)
     	if employeesWorked <=10 Then N = 1.0 + (10-employeesWorked) * 0.05
     	elseif employeesWorked <=20 Then N = 1.0 - (employeesWorked-10) * 0.03
     	elseif employeesWorked <=30 Then N = 0.7 - (employeesWorked-20) * 0.02
     	else N=0.5;
     C
     	1 If home country controls capital
     	0.75 If not
     R
     	for manufacture companies:
     		1.25 If region's country owns the appropriate high raw. (eg: Iron for Weapons)
     		1 If region's country do not own the appropriate high raw.
     	for raw companies:
     		1.0 in high regions
     		0.75 in medium region.
     Q
     	1.0 for manufacture companies
     	for raw companies
     		1.0 for Q1 companies
     		1.2 for Q2 companies
     		1.4 for Q3 companies
     		1.6 for Q4 companies
     		1.8 for Q5 companies
     * 
     */
     $job = new Job();
     $job = $job->getByUid($this->uid);
     if (!$job) {
         throw new Exception("you don't have a job");
     }
     $skills = new Skill();
     $skills->get($this->uid);
     $E = $skills->economic;
     $employeesWorked = 1;
     //ToDO PENDING
     if ($employeesWorked <= 10) {
         $N = 1.0 + (10 - $employeesWorked) * 0.05;
     } elseif ($employeesWorked <= 20) {
         $N = 1.0 - ($employeesWorked - 10) * 0.03;
     } elseif ($employeesWorked <= 30) {
         $N = 0.7 - ($employeesWorked - 20) * 0.02;
     } else {
         $N = 0.5;
     }
     $company = new Company();
     $company->get($job->company);
     $region = new Region();
     $companyRegion = $region->get($company->region);
     //does the region have the resource that company produces?
     // also determine product quality
     if ($company->productType == Company::PRODUCT_TYPE_RESOURCE) {
         $R = $companyRegion->resourceAmount / 10;
         $Q = 1;
     } else {
         $product = new Product();
         $product->get($company->product);
         if ($companyRegion->resourceType == $product->resource) {
             $R = 1.25;
         } else {
             $R = 1;
         }
         $Q = 0.8 + 0.2 * $company->quality;
     }
     $country = new Country();
     $country = $country->get($companyRegion->country);
     $capitalRegion = $region->get($country->capitalRegionId);
     //is country capital owned by original owners?
     if ($capitalRegion->country == $capitalRegion->countryConqueror) {
         $C = 1;
     } else {
         $C = 0.75;
     }
     if ($companyRegion->resourceAmount > 0) {
         $productivity = 10 * (4 + $E) * $N * $C * $R * $Q;
     } else {
         $productivity = 10 * (4 + $E) * $N * $C * $Q;
     }
     $user = new User($this->uid);
     $user->updateXP('WORK');
     $skills->economic += 0.125;
     $skills->save();
     $company->pendingUnits += $productivity;
     //calculate produced units
     if ($company->productType == Company::PRODUCT_TYPE_RESOURCE) {
         $createdUnits = floor($company->pendingUnits);
         $company->pendingUnits -= $createdUnits;
         $added = $company->addStock($createdUnits, Company::PRODUCT_TYPE_PRODUCT);
         if ($added) {
             $company->save();
         }
     } else {
         $minProduct = $product->productivityBase * $company->quality;
         $createdUnits = floor($company->pendingUnits / $minProduct);
         if ($company->pendingUnits > $minProduct) {
         }
         $company->pendingUnits -= $createdUnits * $minProduct;
         $added = $company->addStock($createdUnits, Company::PRODUCT_TYPE_PRODUCT);
         if ($added) {
             $company->save();
         }
     }
     //pay salary
     $transactionData = array('quantity' => $job->salary, 'action' => 'PAY_SALARY', 'receiver' => $this->uid, 'receiverType' => Company::RECEIVER_TYPE_USER);
     if ($company->transaction($transactionData)) {
         //save historial
         Service::getDB()->insert('work_historial', array('uid' => $this->uid, 'date' => $this->now()));
         return array('productivity' => $productivity, 'createdUnits' => $createdUnits);
     } else {
         return false;
     }
 }
Ejemplo n.º 7
0
 function testGetSkills()
 {
     //Arrange
     $description_id = 1;
     $race_id = 1;
     $stat_id = 1;
     $test_character = new Character($description_id, $race_id, $stat_id);
     $test_character->save();
     $name = "Acrobatics";
     $description = "stuff";
     $id = 1;
     $test_skill = new Skill($name, $description, $id);
     $test_skill->save();
     $name2 = "Athletics";
     $description2 = "other stuff";
     $id2 = 2;
     $test_skill2 = new Skill($name2, $description2, $id2);
     $test_skill2->save();
     //Act
     $test_character->addSkill($test_skill);
     $test_character->addSkill($test_skill2);
     //Assert
     $this->assertEquals($test_character->getSkills(), [$test_skill, $test_skill2]);
 }
Ejemplo n.º 8
0
 function test_find()
 {
     //Arrange
     $name = "Acrobatics";
     $description = "stuff";
     $id = 1;
     $test_class = new Skill($name, $description, $id);
     $test_class->save();
     $name2 = "Athletics";
     $description2 = "other stuff";
     $id2 = 2;
     $test_class2 = new Skill($name2, $description2, $id2);
     $test_class2->save();
     //Act
     $result = Skill::find($test_class->getId());
     //Assert
     $this->assertEquals($test_class, $result);
 }
 /**
  * Store a newly created template in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Template::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         $template = new Template();
         $template->color = Input::get('color');
         $template->layout = Input::get('templateID');
         $template->user_id = Auth::id();
         $template->save();
         //Storing header info
         if (Input::has('headerJobTitle')) {
             $header = new Header1();
             $header->job_title = Input::get('headerJobTitle');
             $header->template_id = $template->id;
             if (Input::has('headerResumeTitle')) {
                 $header->description = Input::get('headerResumeTitle');
             }
             if (Input::hasFile('headerImage')) {
                 $header->picture = Input::file('headerImage')->move("images/uploaded/");
             }
             if (Input::has('headerJobTitle')) {
                 $header->description = Input::get('headerJobTitle');
             }
             $header->save();
         }
         //Storing adjectives for template 2
         if (Input::has('adjectives1')) {
             $header1 = new Header1();
             $header1->template_id = $template->id;
             $header1->adjective = Input::get('adjectives1');
             $header1->save();
         }
         if (Input::has('adjectives2')) {
             $header2 = new Header1();
             $header2->template_id = $template->id;
             $header2->adjective = Input::get('adjectives2');
             $header2->save();
         }
         if (Input::has('adjectives3')) {
             $header3 = new Header1();
             $header3->template_id = $template->id;
             $header3->adjective = Input::get('adjectives3');
             $header3->save();
         }
         //Checking for up to 6 skill inputs to be accpeted
         if (Input::has('skillPercent1') && Input::has('skillTitle1')) {
             $skill1 = new Skill();
             $skill1->template_id = $template->id;
             $skill1->percent = Input::get('skillPercent1');
             $skill1->skill_title = Input::get('skillTitle1');
             if (Input::has('skillDescription1')) {
                 $skill1->description = Input::get('skillDescription1');
             }
             if (Input::has('skillDescriptionTitle1')) {
                 $skill1->description_title = Input::get('skillDescriptionTitle1');
             }
             if (Input::has('hobbies1')) {
                 $skill1->description_title = Input::get('hobbies1');
             }
             $skill1->save();
         }
         if (Input::has('skillPercent2') && Input::has('skillTitle2')) {
             $skill2 = new Skill();
             $skill2->template_id = $template->id;
             $skill2->percent = Input::get('skillPercent2');
             $skill2->skill_title = Input::get('skillTitle2');
             if (Input::has('skillDescription2')) {
                 $skill2->description = Input::get('skillDescription2');
             }
             if (Input::has('skillDescriptionTitle2')) {
                 $skill2->description_title = Input::get('skillDescriptionTitle2');
             }
             if (Input::has('hobbies2')) {
                 $skill2->description_title = Input::get('hobbies2');
             }
             $skill2->save();
         }
         if (Input::has('skillPercent3') && Input::has('skillTitle3')) {
             $skill3 = new Skill();
             $skill3->template_id = $template->id;
             $skill3->percent = Input::get('skillPercent3');
             $skill3->skill_title = Input::get('skillTitle3');
             if (Input::has('skillDescription3')) {
                 $skill3->description = Input::get('skillDescription3');
             }
             if (Input::has('skillDescriptionTitle3')) {
                 $skill3->description_title = Input::get('skillDescriptionTitle3');
             }
             if (Input::has('hobbies3')) {
                 $skill3->description_title = Input::get('hobbies3');
             }
             $skill3->save();
         }
         if (Input::has('skillPercent4') && Input::has('skillTitle4')) {
             $skill4 = new Skill();
             $skill4->template_id = $template->id;
             $skill4->percent = Input::get('skillPercent4');
             $skill4->skill_title = Input::get('skillTitle4');
             if (Input::has('skillDescription4') && Input::has('descriptionTitle4')) {
                 $skill4->description = Input::get('skillDescription4');
             }
             if (Input::has('skillDescriptionTitle4')) {
                 $skill4->description_title = Input::get('skillDescriptionTitle4');
             }
             $skill4->save();
         }
         if (Input::has('skillPercent5') && Input::has('skillTitle5')) {
             $skill5 = new Skill();
             $skill5->template_id = $template->id;
             $skill5->percent = Input::get('skillPercent5');
             $skill5->skill_title = Input::get('skillTitle5');
             if (Input::has('skillDescription5')) {
                 $skill5->description = Input::get('skillDescription5');
             }
             if (Input::has('skillDescriptionTitle5')) {
                 $skill5->description_title = Input::get('skillDescriptionTitle5');
             }
             $skill5->save();
         }
         //Knowledge storage starts here for template 2
         if (Input::has('knowledge1') && Input::has('miscHead1') && Input::has('miscFoot1') && Input::has('miscPercent1')) {
             $knowledge1 = new Knowledge();
             $knowledge1->template_id = $template->id;
             $knowledge1->knowledge_item = Input::get('knowledge1');
             $knowledge1->sub_percent = Input::get('miscPercent1');
             $knowledge1->sub_head = Input::get('miscHead1');
             $knowledge1->sub_foot = Input::get('miscFoot1');
             if (Input::has('miscTitle1')) {
                 $knowledge1->sub_title = Input::get('miscTitle1');
             }
             $knowledge1->save();
         }
         if (Input::has('knowledge2') && Input::has('miscHead2') && Input::has('miscFoot2') && Input::has('miscPercent2')) {
             $knowledge2 = new Knowledge();
             $knowledge2->template_id = $template->id;
             $knowledge2->knowledge_item = Input::get('knowledge2');
             $knowledge2->sub_percent = Input::get('miscPercent2');
             $knowledge2->sub_head = Input::get('miscHead2');
             $knowledge2->sub_foot = Input::get('miscFoot2');
             $knowledge2->save();
         }
         if (Input::has('knowledge3') && Input::has('miscHead3') && Input::has('miscFoot3') && Input::has('miscPercent3')) {
             $knowledge3 = new Knowledge();
             $knowledge3->template_id = $template->id;
             $knowledge3->knowledge_item = Input::get('knowledge3');
             $knowledge3->sub_percent = Input::get('miscPercent3');
             $knowledge3->sub_head = Input::get('miscHead3');
             $knowledge3->sub_foot = Input::get('miscFoot3');
             $knowledge3->save();
         }
         if (Input::has('knowledge4') && Input::has('miscHead4') && Input::has('miscFoot4') && Input::has('miscPercent4')) {
             $knowledge4 = new Knowledge();
             $knowledge4->template_id = $template->id;
             $knowledge4->knowledge_item = Input::get('knowledge4');
             $knowledge4->sub_percent = Input::get('miscPercent4');
             $knowledge4->sub_head = Input::get('miscHead4');
             $knowledge4->sub_foot = Input::get('miscFoot4');
             $knowledge4->save();
         }
         if (Input::has('aboutDescription1')) {
             $abouts1 = new About();
             $abouts1->template_id = $template->id;
             $abouts1->description = Input::get('aboutDescription1');
             if (Input::has('aboutTitle')) {
                 $abouts1->title = Input::get('aboutTitle');
             }
             if (Input::hasFile('aboutBackgroundImage1')) {
                 $abouts1->picture = Input::file('aboutBackgroundImage1')->move("images/uploaded/");
             }
             $abouts1->save();
         }
         if (Input::has('aboutDescription2')) {
             $abouts2 = new About();
             $abouts2->template_id = $template->id;
             $abouts2->description = Input::get('aboutDescription2');
             if (Input::has('aboutTitle')) {
                 $abouts2->title = Input::get('aboutTitle');
             }
             if (Input::hasFile('aboutBackgroundImage2')) {
                 $abouts2->picture = Input::file('aboutBackgroundImage2')->move("images/uploaded/");
             }
             $abouts2->save();
         }
         if (Input::has('aboutDescription3')) {
             $abouts3 = new About();
             $abouts3->template_id = $template->id;
             $abouts3->description = Input::get('aboutDescription3');
             if (Input::has('aboutTitle')) {
                 $abouts3->title = Input::get('aboutTitle');
             }
             if (Input::hasFile('aboutBackgroundImage3')) {
                 $abouts3->picture = Input::file('aboutBackgroundImage3')->move("images/uploaded/");
             }
             $abouts3->save();
         }
         if (Input::has('contactDescription')) {
             $contacts = new Contact();
             $contacts->template_id = $template->id;
             $contacts->description = Input::get('contactDescription');
             $contacts->save();
         }
         //Storing services currently for template 2
         if (Input::has('serviceTitle1') || Input::has('serviceTitle2') || Input::has('serviceTitle3') || Input::has('serviceTitle4') || Input::has('serviceTitle5') || Input::has('serviceTitle6')) {
             if (Input::has('serviceTitle1') && Input::has('serviceDescription1')) {
                 $service1 = new Service();
                 $service1->template_id = $template->id;
                 $service1->title = Input::get('serviceTitle1');
                 $service1->description = Input::get('serviceDescription1');
                 $service1->save();
             }
             if (Input::has('serviceTitle2') && Input::has('serviceDescription2')) {
                 $service2 = new Service();
                 $service2->template_id = $template->id;
                 $service2->title = Input::get('serviceTitle2');
                 $service2->description = Input::get('serviceDescription2');
                 $service2->save();
             }
             if (Input::has('serviceTitle3') && Input::has('serviceDescription3')) {
                 $service3 = new Service();
                 $service3->template_id = $template->id;
                 $service3->title = Input::get('serviceTitle3');
                 $service3->description = Input::get('serviceDescription3');
                 $service3->save();
             }
             if (Input::has('serviceTitle4') && Input::has('serviceDescription4')) {
                 $service4 = new Service();
                 $service4->template_id = $template->id;
                 $service4->title = Input::get('serviceTitle4');
                 $service4->description = Input::get('serviceDescription4');
                 $service4->save();
             }
             if (Input::has('serviceTitle5') && Input::has('serviceDescription5')) {
                 $service5 = new Service();
                 $service5->template_id = $template->id;
                 $service5->title = Input::get('serviceTitle5');
                 $service5->description = Input::get('serviceDescription5');
                 $service5->save();
             }
             if (Input::has('serviceTitle6') && Input::has('serviceDescription6')) {
                 $service6 = new Service();
                 $service6->template_id = $template->id;
                 $service6->title = Input::get('serviceTitle6');
                 $service6->description = Input::get('serviceDescription6');
                 $service6->save();
             }
         }
         //There are the inputs for the portfolio storeTemplate1Images
         if (Input::has('portfolioDescription1')) {
             $portfolio1 = new Portfolio();
             if (Input::has('portfolioTitle1')) {
                 $portfolio1->title = Input::get('portfolioTitle1');
             }
             $portfolio1->template_id = $template->id;
             $portfolio1->description = Input::get('portfolioDescription1');
             if (Input::hasFile('portfolioPicture1')) {
                 $portfolio1->picture = Input::file('portfolioPicture1')->move("img/uploaded/");
             }
             if (Input::has('portfolioLink1')) {
                 $portfolio1->link = Input::get('portfolioLink1');
             }
             if (Input::has('portfolioCategory1')) {
                 $portfolio1->category = Input::get('portfolioCategory1');
             }
             $portfolio1->save();
         }
         if (Input::has('portfolioDescription2')) {
             $portfolio2 = new Portfolio();
             if (Input::has('portfolioTitle2')) {
                 $portfolio2->title = Input::get('portfolioTitle2');
             }
             $portfolio2->template_id = $template->id;
             $portfolio2->description = Input::get('portfolioDescription2');
             if (Input::hasFile('portfolioPicture2')) {
                 $portfolio2->picture = Input::file('portfolioPicture2')->move("img/uploaded/");
             }
             if (Input::has('portfolioLink2')) {
                 $portfolio2->link = Input::get('portfolioLink2');
             }
             if (Input::has('portfolioCategory2')) {
                 $portfolio2->category = Input::get('portfolioCategory2');
             }
             $portfolio2->save();
         }
         if (Input::has('portfolioDescription3')) {
             $portfolio3 = new Portfolio();
             if (Input::has('portfolioTitle3')) {
                 $portfolio3->title = Input::get('portfolioTitle3');
             }
             $portfolio3->template_id = $template->id;
             $portfolio3->description = Input::get('portfolioDescription3');
             if (Input::hasFile('portfolioPicture3')) {
                 $portfolio3->picture = Input::file('portfolioPicture3')->move("img/uploaded/");
             }
             if (Input::has('portfolioLink3')) {
                 $portfolio3->link = Input::get('portfolioLink3');
             }
             if (Input::has('portfolioCategory3')) {
                 $portfolio3->category = Input::get('portfolioCategory3');
             }
             $portfolio3->save();
         }
         if (Input::has('portfolioDescription4')) {
             $portfolio4 = new Portfolio();
             if (Input::has('portfolioTitle4')) {
                 $portfolio4->title = Input::get('portfolioTitle4');
             }
             $portfolio4->template_id = $template->id;
             $portfolio4->description = Input::get('portfolioDescription4');
             if (Input::hasFile('portfolioPicture4')) {
                 $portfolio4->picture = Input::file('portfolioPicture4')->move("img/uploaded/");
             }
             if (Input::has('portfolioLink4')) {
                 $portfolio4->link = Input::get('portfolioLink4');
             }
             if (Input::has('portfolioCategory4')) {
                 $portfolio4->category = Input::get('portfolioCategory4');
             }
             $portfolio4->save();
         }
         if (Input::has('portfolioDescription5')) {
             $portfolio5 = new Portfolio();
             if (Input::has('portfolioTitle5')) {
                 $portfolio5->title = Input::get('portfolioTitle5');
             }
             $portfolio5->template_id = $template->id;
             $portfolio5->description = Input::get('portfolioDescription5');
             if (Input::hasFile('portfolioPicture5')) {
                 $portfolio5->picture = Input::file('portfolioPicture5')->move("img/uploaded/");
             }
             if (Input::has('portfolioLink5')) {
                 $portfolio5->link = Input::get('portfolioLink5');
             }
             if (Input::has('portfolioCategory5')) {
                 $portfolio5->category = Input::get('portfolioCategory5');
             }
             $portfolio5->save();
         }
         if (Input::has('portfolioDescription6')) {
             $portfolio6 = new Portfolio();
             if (Input::has('portfolioTitle6')) {
                 $portfolio6->title = Input::get('portfolioTitle6');
             }
             $portfolio6->template_id = $template->id;
             $portfolio6->description = Input::get('portfolioDescription6');
             if (Input::hasFile('portfolioPicture6')) {
                 $portfolio6->picture = Input::file('portfolioPicture6')->move("img/uploaded/");
             }
             if (Input::hasFile('portfolioLink6')) {
                 $portfolio6->link = Input::get('portfolioLink6');
             }
             if (Input::hasFile('portfolioCategory6')) {
                 $portfolio6->category = Input::get('portfolioCategory6');
             }
             $portfolio6->save();
         }
         //Awards
         if (Input::has('awardTitle1') && Input::has('awardNumber1')) {
             $award1 = new Award();
             $award1->template_id = $template->id;
             $award1->award_number = Input::get('awardTitle1');
             $award1->award_title = Input::get('awardNumber1');
             $award1->save();
         }
         if (Input::has('awardTitle2') && Input::has('awardNumber2')) {
             $award2 = new Award();
             $award2->template_id = $template->id;
             $award2->award_number = Input::get('awardTitle2');
             $award2->award_title = Input::get('awardNumber2');
             $award2->save();
         }
         if (Input::has('awardTitle3') && Input::has('awardNumber3')) {
             $award3 = new Award();
             $award3->template_id = $template->id;
             $award3->award_number = Input::get('awardTitle3');
             $award3->award_title = Input::get('awardNumber3');
             $award3->save();
         }
         //Storing up to 6 work experience sections
         if (Input::has('workExperienceStart1') && Input::has('workExperienceDescription1') && Input::has('workExperienceTitle1')) {
             $experience1 = new workExperience();
             if (Input::has('workExperienceExtraText1')) {
                 $experience1->description = Input::get('workExperienceExtraText1');
             }
             $experience1->template_id = $template->id;
             $experience1->start_date = Input::get('workExperienceStart1');
             $experience1->title = Input::get('workExperienceTitle1');
             $experience1->description = Input::get('workExperienceDescription1');
             if (Input::has('workExperienceEnd1')) {
                 $experience1->end_date = Input::get('workExperienceEnd1');
             }
             $experience1->save();
         }
         if (Input::has('workExperienceStart2') && Input::has('workExperienceDescription2') && Input::has('workExperienceTitle2')) {
             $experience2 = new workExperience();
             $experience2->template_id = $template->id;
             $experience2->start_date = Input::get('workExperienceStart2');
             $experience2->title = Input::get('workExperienceTitle2');
             $experience2->description = Input::get('workExperienceDescription2');
             if (Input::has('workExperienceEnd2')) {
                 $experience2->end_date = Input::get('workExperienceEnd2');
             }
             $experience2->save();
         }
         if (Input::has('workExperienceStart3') && Input::has('workExperienceDescription3') && Input::has('workExperienceTitle3')) {
             $experience3 = new workExperience();
             $experience3->template_id = $template->id;
             $experience3->start_date = Input::get('workExperienceStart3');
             $experience3->title = Input::get('workExperienceTitle3');
             $experience3->description = Input::get('workExperienceDescription3');
             if (Input::has('workExperienceEnd3')) {
                 $experience3->end_date = Input::get('workExperienceEnd3');
             }
             $experience3->save();
         }
         if (Input::has('workExperienceStart4') && Input::has('workExperienceDescription4') && Input::has('workExperienceTitle4')) {
             $experience4 = new workExperience();
             $experience4->template_id = $template->id;
             $experience4->start_date = Input::get('workExperienceStart4');
             $experience4->title = Input::get('workExperienceTitle4');
             $experience4->description = Input::get('workExperienceDescription4');
             if (Input::has('workExperienceEnd4')) {
                 $experience4->end_date = Input::get('workExperienceEnd4');
             }
             $experience4->save();
         }
         if (Input::has('workExperienceStart5') && Input::has('workExperienceDescription5') && Input::has('workExperienceTitle5')) {
             $experience5 = new workExperience();
             $experience5->template_id = $template->id;
             $experience5->start_date = Input::get('workExperienceStart5');
             $experience5->title = Input::get('workExperienceTitle5');
             $experience5->description = Input::get('workExperienceDescription5');
             if (Input::has('workExperienceEnd5')) {
                 $experience5->end_date = Input::get('workExperienceEnd5');
             }
             $experience5->save();
         }
         if (Input::has('workExperienceStart6') && Input::has('workExperienceDescription6') && Input::has('workExperienceTitle6')) {
             $experience6 = new workExperience();
             $experience6->template_id = $template->id;
             $experience6->start_date = Input::get('workExperienceStart6');
             $experience6->title = Input::get('workExperienceTitle6');
             $experience6->description = Input::get('workExperienceDescription6');
             if (Input::has('workExperienceEnd6')) {
                 $experience6->end_date = Input::get('workExperienceEnd6');
             }
             $experience6->save();
         }
         if (Input::has('educationStart1') && Input::has('educationDescription1') && Input::has('educationTitle1')) {
             $education1 = new Education();
             $education1->template_id = $template->id;
             $education1->start_date = Input::get('educationStart1');
             if (Input::has('educationEnd1')) {
                 $education1->end_date = Input::get('educationEnd1');
             }
             $education1->title = Input::get('educationTitle1');
             $education1->description = Input::get('educationDescription1');
             $education1->save();
         }
         if (Input::has('educationStart2') && Input::has('educationDescription2') && Input::has('educationTitle2')) {
             $education2 = new Education();
             $education2->template_id = $template->id;
             $education2->start_date = Input::get('educationStart2');
             if (Input::has('educationEnd2')) {
                 $education2->end_date = Input::get('educationEnd2');
             }
             $education2->title = Input::get('educationTitle2');
             $education2->description = Input::get('educationDescription2');
             $education2->save();
         }
         if (Input::has('educationStart3') && Input::has('educationDescription3') && Input::has('educationTitle3')) {
             $education3 = new Education();
             $education3->template_id = $template->id;
             $education3->start_date = Input::get('educationStart3');
             if (Input::has('educationEnd3')) {
                 $education3->end_date = Input::get('educationEnd3');
             }
             $education3->title = Input::get('educationTitle3');
             $education3->description = Input::get('educationDescription3');
             $education3->save();
         }
         if (Input::has('educationStart4') && Input::has('educationDescription4') && Input::has('educationTitle4')) {
             $education4 = new Education();
             $education4->template_id = $template->id;
             $education4->start_date = Input::get('educationStart4');
             if (Input::has('educationEnd4')) {
                 $education4->end_date = Input::get('educationEnd4');
             }
             $education4->title = Input::get('educationTitle4');
             $education4->description = Input::get('educationDescription4');
             $education4->save();
         }
     }
     return Redirect::action('UsersController@getProfile');
 }
Ejemplo n.º 10
0
 static function addData()
 {
     // SKILLS:
     $skill1 = new Skill("Acrobatics", "Balancing and tumbling", 1);
     $skill2 = new Skill("Animal Handling", "Using or interacting with domesticated animals.", 2);
     $skill3 = new Skill("Arcana", "Magic related lore and knowledge.", 3);
     $skill4 = new Skill("Athletics", "Climbing, jumping, and swimming.", 4);
     $skill5 = new Skill("Deception", "Hide the truth.", 5);
     $skill6 = new Skill("History", "Recall historical events.", 6);
     $skill7 = new Skill("Insight", "Determine a creature's true intentions.", 7);
     $skill8 = new Skill("Intimidation", "Influence by using threats.", 8);
     $skill9 = new Skill("Investigation", "Look for clues and find hidden things.", 9);
     $skill10 = new Skill("Medicine", "Stabilize the dying or diagnose a disease.", 10);
     $skill11 = new Skill("Nature", "Recall weather, plant, or animal lore.", 11);
     $skill12 = new Skill("Perception", "See, hear, or smell the presence or something.", 12);
     $skill13 = new Skill("Performance", "Ability in dancing, singing, or storytelling.", 13);
     $skill14 = new Skill("Persuasion", "Influence by using goodwill.", 14);
     $skill15 = new Skill("Religion", "Recall religious lore.", 15);
     $skill16 = new Skill("Sleight of Hand", "Concealing items or stealing things.", 16);
     $skill17 = new Skill("Stealth", "Sneaking or hiding.", 17);
     $skill18 = new Skill("Survival", "Track and hunt, avoid hazards, or predict weather.", 18);
     $skill1->save();
     $skill2->save();
     $skill3->save();
     $skill4->save();
     $skill5->save();
     $skill6->save();
     $skill7->save();
     $skill8->save();
     $skill9->save();
     $skill10->save();
     $skill11->save();
     $skill12->save();
     $skill13->save();
     $skill14->save();
     $skill15->save();
     $skill16->save();
     $skill17->save();
     $skill18->save();
     // RACES:
     $race1 = new Race("Good all around, well balanced, adventurer.  Easy to role play and fits most roles well.", "Human", 1);
     $race2 = new Race("Tough and wise. Good clerics. Bearded and can live to over 400. A bit more open than mountain dwarves.", "Hill Dwarf", 2);
     $race3 = new Race("Strong and tough. Good fighters. Bearded and can live to over 400. Likes to keep to their own.", "Mountain Dwarf", 3);
     $race4 = new Race("Fast and intelligent. Good fighters, rogues or wizards. Bronze skin. Has air of superiority.", "High Elf", 4);
     $race5 = new Race("Fast and wise. Good clerics and fighters. Copper/green skin. Very in tune with nature.", "Wood Elf", 5);
     $race6 = new Race("Fast and charismatic. Good rogues. Easily overlooked. Wanderers. Around 3 feet tall.", "Lightfoot Halfling", 6);
     $race7 = new Race("Tough and fast. Good fighters or rogues. Strong natured and boisterous.", "Stout Halfling", 7);
     $race1->save();
     $race2->save();
     $race3->save();
     $race4->save();
     $race5->save();
     $race6->save();
     $race7->save();
     // CLASSES:
     $class1 = new CharClass("Cleric", "Wise and charismatic. Typically a healer who wields divine power in the service of their diety.", 1);
     $class2 = new CharClass("Fighter", "Strong and tough or fast and tough. Master of combat and knowledgable in weapons and armor.", 2);
     $class3 = new CharClass("Rogue", "Fast and intelligent. Highly skilled and commonly duplicitous. Commonly a seeker of treasures.", 3);
     $class4 = new CharClass("Wizard", "Intelligent and wise. Weaves magic spells that manipulate reality using long studied arcane knowledge.", 4);
     $class1->save();
     $class2->save();
     $class3->save();
     $class4->save();
     // BACKGROUNDS:
     $background1 = new Background("Hermit", "Medicine and religion. Your life has been lonely and you have a secret knowledge.", 1);
     $background2 = new Background("Noble", "History and persuasion. Your life has been luxurious and you benefit from your position of privilege.", 2);
     $background3 = new Background("Soldier", "Athletics and intimidation. Your life has been touched by war and you are recognized by your military rank.", 3);
     $background4 = new Background("Urchin", "Sleight of Hand and Stealth. Your life has been impoverished and you are intimately familiar with city workings.", 4);
     $background1->save();
     $background2->save();
     $background3->save();
     $background4->save();
 }