Exemplo n.º 1
0
 /**
  * The development index handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Gallery = new Gallery();
     $Award = new Award();
     $this->getView()->set('Gallery', $Gallery->findItem(array('Type = ' . Gallery::DEVELOPMENT)));
     $this->getView()->set('Patents', $Award->findList(array('Type = ' . Award::PATENT), 'Position asc'));
     return $this->getView()->render();
 }
Exemplo n.º 2
0
 /**
  * The function returns short HTML block for current page.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function htmlShort()
 {
     $Page = new Content_Page();
     $Page = $Page->findItem(array('Module = Controller_Frontend_Certificates'));
     $Award = new Award();
     $Papers = $Award->findList(array('Type = ' . Award::CERTIFICATE), 'Position asc', 0, 4);
     return $this->getView()->htmlShort($Page, $Papers);
 }
Exemplo n.º 3
0
 /**
  * The support index handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Page = $this->getContentPage();
     $Award = new Award();
     $Faq = new Faq();
     $Article = new Article();
     $params = array();
     $params[] = 'Type = ' . Article::ARTICLE;
     $params[] = 'PostedAt < ' . time();
     $params[] = $Article->getParam('reference', $Page);
     $this->getView()->set(array('Documents' => $Page->getDocuments(), 'Faqs' => $Faq->findList(array(), 'Position asc'), 'Papers' => $Award->findList(array('Type = ' . Award::SUPPORT), 'Position asc'), 'Articles' => $Article->findList($params, 'PostedAt desc')));
     return $this->getView()->render();
 }
 /**
  * Returns all award receipts for the given award
  * @param Award $award
  * @return InternalAwardReceipts
  */
 private static function getByAward(Award $award)
 {
     global $db;
     $query = "SELECT a.`id` as `award_receipt_id`, a.`user_id`, a.`year` \n\t\t\t\tFROM `" . DATABASE_NAME . "`.`student_awards_internal` a \n\t\t\t\tWHERE a.`award_id` = " . $db->qstr($award->getID()) . " \n\t\t\t\torder by a.year desc";
     $results = $db->GetAll($query);
     $receipts = array();
     if ($results) {
         foreach ($results as $result) {
             $receipt = new InternalAwardReceipt($result['user_id'], $award, $result['award_receipt_id'], $result['year']);
             $receipts[] = $receipt;
         }
     }
     return new self($receipts);
 }
 /**
  * Constructs an Internal Award. 
  * @param string $id
  * @param string $title
  * @param string $terms
  * @param bool $disabled
  */
 function __construct($id, $title, $terms, $disabled)
 {
     $awarding_body = INTERNAL_AWARD_AWARDING_BODY;
     parent::__construct($title, $terms, $awarding_body);
     $this->id = $id;
     $this->disabled = $disabled;
 }
Exemplo n.º 6
0
 /**
  * The Constructor for the User class. Queries the database and assigns values to the approriate variables.
  * @param integer $id
  * @throws DBException
  */
 public function __construct($id)
 {
     global $mysqli;
     $query = $mysqli->query("SELECT * FROM users WHERE id = {$id}");
     if (!$query) {
         throw new DBException('Can\'t get user.', $mysqli->error);
     }
     $result = $query->fetch_array();
     extract($result);
     $this->id = $id;
     $this->username = $username;
     $this->name = $name;
     $this->email = $email;
     $this->merits = $merits;
     $this->rank = new Rank($rank);
     $this->leader = $divleader == 1;
     $this->subleader = $subdivleader == 1;
     $this->division = new Division($division);
     $this->sc = new SecurityClearance($clearance);
     if ($clearance == 7 || $admin != 0) {
         $this->admin = new Admin($id);
     }
     /*if ($nominator == 1)
           $this->nominator = true;
       if ($approver == 1)
           $this->approver = true;*/
     $this->awards = Award::getUserAwards($this);
     /*if ($clearance <= 6) {
           $this->division = new Division($div);
           $this->sc = new SecurityClearance($clearance);
       } else {
           $this->admin = new Admin($clearance, $div);
       }*/
 }
 protected function envAward()
 {
     $award = new Award();
     $award->award_number = '22';
     $award->award_title = '#johnslife';
     $award->template_id = 1;
     $award->save();
     $award2 = new Award();
     $award2->award_number = '22';
     $award2->award_title = '#daveslife';
     $award2->template_id = 2;
     $award2->save();
     $award3 = new Award();
     $award3->award_number = '22';
     $award3->award_title = '#daveslife';
     $award3->template_id = 3;
     $award3->save();
 }
Exemplo n.º 8
0
 /**
  * The upload form handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function upload()
 {
     $error = array();
     if (isset($_POST['submit'])) {
         if (isset($_FILES['file'])) {
             foreach ($_FILES['file']['name'] as $id => $value) {
                 $file = array('name' => $_FILES['file']['name'][$id], 'type' => $_FILES['file']['type'][$id], 'tmp_name' => $_FILES['file']['tmp_name'][$id], 'error' => $_FILES['file']['error'][$id], 'size' => $_FILES['file']['size'][$id]);
                 if ($file['tmp_name']) {
                     $Award = new Award();
                     $Award->Type = intval(Request::get('t'));
                     if ($Award->save()) {
                         if (File::upload($Award, $file)) {
                             $Award->save();
                         }
                     }
                 }
             }
         }
         return $this->halt('', true);
     }
     $this->getView()->set('Error', $error);
     return $this->getView()->render();
 }
Exemplo n.º 9
0
 public function Activation($id)
 {
     $User = M("User");
     $BaseConfig = M("BaseConfig");
     $objUser = $User->where('id=' . $id)->find();
     $unit_count = $objUser['unit_count'];
     //累计左右区用户数
     self::DoUserSubcount($id, 1, $unit_count);
     $Award = new Award();
     //推荐奖
     $Award->AwardRec($id);
     //组织业绩
     //$Award->AwardOrg($id);
     //对碰奖
     $Award->AwardCom($id);
     //见点奖
     $Award->AwardDot($id);
     //层碰奖
     $Award->AwardLayerCom();
     //把激活对象写到激活表中
     $unitusers = $User->where("id={$id}")->find();
     //dump($unitusers);
     $Active_line = M("ActiceLine");
     $data['user_id'] = $id;
     $data['active_time'] = date('Y-m-d H:i:s');
     $data['status'] = 0;
     $data['pid'] = $Active_line->order('id DESC')->getField('id');
     $data['unit_count'] = $unitusers['unit_count'];
     $Active_line->add($data);
     //排网奖
     $Award->AwardNet($id);
     $Award->AwardLayerCom();
     //更新用户状态
     $datas['status'] = 1;
     $User->where("id={$id}")->data($datas)->save();
     return true;
 }
Exemplo n.º 10
0
 public function testIsMulti()
 {
     $this->assertTrue(Award::isMulti(36));
 }
Exemplo n.º 11
0
Route::any('test-query', function () {
    foreach (Award::getAwards() as $type) {
        preg_match('/\\d+/', $type->name, $matches);
        if ($matches) {
            $id = $matches[0];
        }
        echo "{$id}<br>";
    }
    dd('');
    $start = Task::orderBy('created_at')->first()->created_at;
    $end = Carbon::now();
    $res = [];
    $k = 0;
    $date = clone $start;
    for ($i = $start->weekOfYear; $i <= $end->weekOfYear; $i++) {
        $quary_award = Award::awardsForWeek(Award::AWARD_MOST_TASK_CREATED_WEEK, $date)->first();
        array_push($res, ['i' => $i, 'inc' => $date->weekOfYear, $quary_award]);
        $date->addWeek();
    }
    return [$start->weekOfYear, $end->weekOfYear, $res];
    return Project::orderByMostTasks()->with('user')->get();
    $last_week = last_week();
    $user = User::mostHelpfulForProject()->first();
    return [$user, Project::find($user->most_helped_project)];
    // with('claimedTasks')
    // ->join('tasks', 'users.id', '=', 'tasks.claimed_id')
    // select([
    // 	'users.*',
    // 	DB::raw($sql)
    // ]);
    // ->sortByDesc(function($item) {
 /**
  * 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');
 }
Exemplo n.º 13
0
 public function isSame(Award $award)
 {
     if ($this->id == $award->getAward()) {
         return true;
     }
     return false;
 }
Exemplo n.º 14
0
 /**
  * Compares two awards by title. Alias for $award_1->compare($award_2); 
  * @param Award $award_1
  * @param Award $award_2
  * @return Ambigous <number, number>
  */
 static function compare_awards(Award $award_1, Award $award_2)
 {
     return $award_1->compare($award_2);
 }
Exemplo n.º 15
0
 public function reward()
 {
     global $vbulletin, $vbphrase;
     // <editor-fold defaultstate="collapsed" desc="analysis information">
     if ($this->type == 2) {
         $this->chapternumber = "";
     }
     $this->fansubmember = str_replace('false', '', $this->fansubmember);
     $this->fansubmember = str_replace(',,', '', $this->fansubmember);
     if ($this->postid == 0) {
         $this->postid = $this->manga->postid;
     }
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="create new update post, and new read online thread">
     // <editor-fold defaultstate="collapsed" desc=" create new update post ">
     //normal case: there is update post for the chapter, or there is not but no 18+ content.
     //reward and add chapter to the database only, no need to make any new post. Only set the post to yrmspost.
     if ($this->postid != $this->manga->postid) {
         $vbulletin->db->query_write("UPDATE `" . TABLE_PREFIX . "post` " . "SET `yrmspost`=1 " . "WHERE `postid` = '{$this->postid}'");
         if ($this->rate == 1 && !empty($this->numberofhost)) {
             $downloadpost = $this->buildpost('download');
             editPost($downloadpost);
         }
     } else {
         if ($this->postid == $this->manga->postid && $this->rate == 1) {
             $downloadpost = $this->buildpost('download');
             $this->postid = newPost($downloadpost, $this->poster);
             $vbulletin->db->query_write("UPDATE `" . TABLE_PREFIX . "post` " . "SET `yrmspost`=1 " . "WHERE `postid` = '{$this->postid}'");
         }
     }
     //abnormal case 2: no download link, only readonline link.
     //Skip this step
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc=" create new read online thread ">
     //normal case: readonline post is a separate topic
     //do nothing but set the post to yrms post, and reformat it if the chapter is 18+ content
     if (!empty($this->onlinelink)) {
         $vbulletin->db->query_write("UPDATE `" . TABLE_PREFIX . "post` " . "SET `yrmspost`=1 " . "WHERE `postid` = '{$this->readonlinepostid}'");
         if ($this->rate == 1) {
             $readonlinepost = $this->buildpost('online');
             editPost($readonlinepost);
         }
     }
     //abnormal case: readonline post is the same as update post, or manga post
     //turn it into normal case and treat as normal case
     if (!empty($this->onlinelink) && ($this->readonlinepostid == $this->postid || $this->readonlinepostid == $this->manga->postid || $this->readonlinepostid == 0)) {
         $readonlinepost = $this->buildpost('online');
         $idpack = newThread($readonlinepost, $this->readonlineposter);
         $this->readonlinepostid = $idpack['postid'];
         $vbulletin->db->query_write("UPDATE `" . TABLE_PREFIX . "post` " . "SET `yrmspost`=1 " . "WHERE `postid` = '{$this->readonlinepostid}'");
     }
     // </editor-fold>
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="add chapter to the database ">
     $vbulletin->db->query_write("INSERT INTO `" . TABLE_PREFIX . "yrms_vietsubmanga_chapter`" . "(`mangaid`," . "`postid`, " . "`readonlinepostid`, " . "`active`, " . "`status`, " . "`type`, " . "`chapternumber`, " . "`chaptertitle`, " . "`rate`, " . "`numberofhost`, " . "`downloadlink`, " . "`onlinelink`, " . "`fansubmember`, " . "`fansubnote`) " . "VALUES ('{$this->manga->mangaid}'," . "'{$this->postid}'," . "'{$this->readonlinepostid}'," . "'1'," . "'{$this->status}'," . "'{$this->type}'," . "'{$this->chapternumber}'," . "'{$this->chaptertitle}'," . "'{$this->rate}'," . "'{$this->numberofhost}'," . "'" . serialize($this->downloadlink) . "'," . "'{$this->onlinelink}'," . "'" . serialize($this->fansubmember) . "'," . "'{$this->fansubnote}')");
     $this->chapterid = $vbulletin->db->insert_id();
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="update manga">
     $this->manga->fansubmember = update_array_to_array($this->fansubmember, $this->manga->fansubmember);
     $this->manga->fansubmember = reindex_array($this->manga->fansubmember, array("translator", "proofreader", "editor", "qualitychecker", "uploader"));
     if ($this->type == 1 || $this->type == 2) {
         $this->manga->finishedchapter++;
     }
     if (!empty($this->onlinelink)) {
         $this->manga->readonlinestatus = 1;
     }
     $chapterhostname = array();
     if (!empty($this->numberofhost)) {
         foreach ($this->downloadlink as $hostname => $hostlink) {
             $chapterhostname[] = $hostname;
         }
         $this->manga->hostname = update_array_to_array($chapterhostname, $this->manga->hostname);
         $this->manga->numberofhost = count($this->manga->hostname);
     }
     $this->manga->update();
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc=" reward ">
     //For download post
     $award_download = new Award();
     $award_download->postid = $this->postid;
     if (strpos(strtolower($this->manga->fansubsite), 'yurivn')) {
         $award_download->awardcontent = $this->build_awardcontent_fansubmember();
     }
     if (!empty($this->numberofhost)) {
         if (array_key_exists($this->poster, $award_download->awardcontent)) {
             $award_download->awardcontent[$this->poster] += $vbulletin->options['yrms_vietsubmanga_yun_uploader'];
         } else {
             $award_download->awardcontent += array($this->poster => $vbulletin->options['yrms_vietsubmanga_yun_uploader']);
         }
         if ($this->numberofhost >= 2) {
             if (array_key_exists($this->poster, $award_download->awardcontent)) {
                 $award_download->awardcontent[$this->poster] += $vbulletin->options['yrms_vietsubmanga_yun_mirror'];
             } else {
                 $award_download->awardcontent += array($this->poster => $vbulletin->options['yrms_vietsubmanga_yun_mirror']);
             }
         }
     }
     $award_download->resourcetype = 'vietsubmanga';
     $award_download->resourceid = $this->chapterid;
     $award_download->resourceheadid = $this->manga->mangaid;
     $award_download->add();
     //For readonline post
     if (!empty($this->readonlinepostid)) {
         $award_online = new Award();
         $award_online->postid = $this->readonlinepostid;
         $award_online->awardcontent = array($this->readonlineposter => $vbulletin->options['yrms_vietsubmanga_yun_online']);
         $award_online->resourcetype = 'vietsubmanga';
         $award_online->resourceid = $this->chapterid;
         $award_online->resourceheadid = $this->manga->mangaid;
         $award_online->add();
     }
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc=" return the success message ">
     if (isset($award_online)) {
         $awardcontent = $award_download->awardcontent + $award_online->awardcontent;
     } else {
         $awardcontent = $award_download->awardcontent;
     }
     $awardinfo = array();
     foreach ($awardcontent as $userid => $amount) {
         $userinfo = fetch_userinfo($userid);
         $username = $userinfo["username"];
         $awardinfo[] = "{$username}: {$amount} {$vbulletin->options['yrms_main_moneyname']}";
     }
     $awardinfo = implode("\n", $awardinfo);
     $return_message = construct_phrase($vbphrase['yrms_msg_success_rewardchapter'], $vbulletin->userinfo['username'], $vbphrase["yrms_chaptertype{$this->type}"] . " " . $this->chapternumber, $this->manga->mangatitle, nl2br($awardinfo));
     return $return_message;
     // </editor-fold>
 }
Exemplo n.º 16
0
                </tr>
            </table>
        </form>
        <div id="test"></div>
        <?php 
                } else {
                    if ($do == 'edit') {
                        //var_dump($_POST);
                        extract($_POST);
                        $awardlist = '';
                        $multi = '';
                        for ($i = 0; $i < count($awards); $i++) {
                            $awardlist .= $awards[$i];
                            if ($i < count($awards) - 1) {
                                $awardlist .= ',';
                            }
                            if (Award::isMulti($awards[$i])) {
                                $award = new Award($awards[$i], NULL, false);
                                $multiName = strtolower($award->getAbbrev()) . 'Multi';
                                $multi .= ${$multiName} . ',';
                            }
                        }
                        $multi = rtrim($multi, ',');
                        Award::updateUserAwards($user, $awardlist, $multi);
                        Event::addEvent($user->getName() . '\'s awards have been modified.', $_SESSION['user'], 2);
                    }
                }
            }
        }
    }
}
Exemplo n.º 17
0
    $inputData = getPost();
    $error = findInputError($inputData);
    if (!$error) {
        $manga->setData($inputData);
        if ($inputData['posturl']) {
            $threadId = extract_threadid_from_url($inputData['posturl']);
            $threadInfo = fetch_threadinfo($threadId);
            if ($threadInfo['forumid'] == $manga->getForumId()) {
                $manga->setThreadId($threadInfo['threadid'])->setPostId($threadInfo['firstpostid'])->setPosterId($threadInfo['postuserid']);
            } elseif ($threadInfo['forumid'] == $manga->getOnlineForumId()) {
                $manga->setPosterId($threadInfo['postuserid']);
            }
        }
        $manga->save();
        $posterId = $manga->getPosterId();
        $award = new Award();
        $award->setPostId($manga->getPostId())->setAwardContent(array("{$posterId}" => $vbulletin->options['yrms_vietsubmanga_yun_newproject']))->setResourceType(Manga::RESOURCE_TYPE)->setResourceId($manga->getMangaId())->save();
        $messagetype = "success";
        $posterInfo = fetch_userinfo($posterId);
        $message = construct_phrase($vbphrase['yrms_msg_success_newmanga'], $posterInfo['username'], $manga->getMangaTitle(), $vbulletin->options['yrms_vietsubmanga_yun_newproject'], $manga->getMangaId());
        $contenttemplatename = 'yrms_message';
    } else {
        $messagetype = "error";
        $message = nl2br(construct_phrase($vbphrase['yrms_msg_error_head'], $vbphrase['yrms_mangaadd']) . "\n" . $error);
    }
}
if (!isset($contenttemplatename)) {
    $contenttemplatename = 'yrms_vietsubmanga_manga_save';
}
if ($inputData['fansubname'] == '') {
    $inputData['fansubname'] = "Yurivn";
Exemplo n.º 18
0
    // form has been submitted
    $obj = new Award();
    $obj->fromHTTPVars($_POST);
    /*
        print"<hr/><pre><code>\n";
        print_r( $_POST );
        print "--------\n";
        print_r( $obj );
        print"</code></pre><hr/>\n";
    */
    $obj->save();
    ?>
<div class="info">Saved.</div>
<?php 
} else {
    $obj = new Award();
    if (!$id) {
        // it's new.
        $obj->journo_id = $journo_id;
    } else {
        // fetch from db
        $sql = <<<EOT
SELECT e.*,
        l.id as src__id,
        l.url as src__url,
        l.title as src__title,
        l.pubdate as src__pubdate,
        l.publication as src__publication
    FROM (journo_awards e LEFT JOIN link l ON e.src=l.id )
    WHERE e.id=?
EOT;
Exemplo n.º 19
0
 /**
  * 执行层碰
  */
 public function do_layer()
 {
     if (!isset($_POST['submit'])) {
         $this->display();
     } else {
         $Award = new Award();
         $Award->AwardLayerCom();
         $this->display();
     }
 }