Example #1
0
File: admin.php Project: ajb/rfpez
 public function action_project_sections_toggle_source($id)
 {
     $section = ProjectSection::find($id);
     $section->source = $section->source == 1 ? 0 : 1;
     $section->save();
     return Redirect::back();
 }
Example #2
0
 public static function change_times_used($section_ids_or_array, $direction)
 {
     if (!is_array($section_ids_or_array)) {
         $section_ids_or_array = array($section_ids_or_array);
     }
     foreach ($section_ids_or_array as $section_id) {
         $section = ProjectSection::find($section_id);
         if ($section) {
             $new_times_used = $section->times_used + $direction;
             if ($new_times_used >= 0) {
                 $section->times_used = $new_times_used;
             }
             $section->save();
         }
     }
 }
Example #3
0
File: seed.php Project: ajb/rfpez
 private function minimal_data()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 5; $i++) {
         Factory::vendor();
     }
     for ($i = 0; $i < 5; $i++) {
         Factory::officer();
     }
     $project_type_1 = ProjectType::first();
     // Create project sections
     $section1 = ProjectSection::create(array('section_category' => 'Deliverables', 'title' => 'Information Architecture', 'public' => true, 'body' => 'Information architecture (IA) and initial site map for the redesigned {{WEBSITE}} site. This IA and site map will be used so copy can be revised and/or developed in-house while the contractor is in the process of executing other deliverable products. Note the IA and site map will only include content/sites currently in the {{WEBSITE}} infrastructure.'));
     $section2 = ProjectSection::create(array('section_category' => 'Deliverables', 'title' => 'Page Templating', 'public' => true, 'body' => 'Complete redesign of {{WEBSITE}} and templates for outreach materials. This includes the complete website, features, applications, blog, social media, mobile, email and newsletters, and any items deemed best to connect with the audiences identified in Deliverable Product #1.'));
     $section3 = ProjectSection::create(array('section_category' => 'Objectives', 'title' => 'Increased Visibility', 'public' => true, 'body' => $faker->paragraph));
     // Link project sections to api project type
     $project_type_1->project_sections()->sync(array($section1->id, $section2->id, $section3->id));
     // Create first project
     $project = new Project(array('project_type_id' => $project_type_1->id, 'title' => 'API for SBA.gov Dynamic Small Business Search', 'agency' => 'Small Business Administration', 'office' => 'Office of Innovation and Research', 'recommended' => true, 'public' => true, 'background' => $faker->paragraph, 'sections' => array($section1->id, $section2->id, $section3->id), 'variables' => array('WEBSITE' => 'api.dsbs.sba.gov'), 'deliverables' => array('Information Architecture' => '1/1/13', 'Page Templating' => '2/8/13'), 'proposals_due_at' => new \DateTime('12/31/2012')));
     $project->posted_to_fbo_at = new \DateTime();
     $project->save();
     // ...And give it to officer1
     $project->officers()->attach(Officer::first()->id, array('owner' => true));
 }
Example #4
0
 public static function section()
 {
     $faker = Faker\Factory::create();
     $s = new ProjectSection(array('section_category' => 'Requirements', 'title' => implode(" ", $faker->words), 'body' => $faker->paragraph, 'public' => rand(0, 8) == 0 ? false : true, 'times_used' => rand(0, 20)));
     $s->save();
     $s->project_types()->sync(ProjectType::lists('id'));
 }
Example #5
0
 public function action_repost_on_fbo_post()
 {
     $project = Config::get('project');
     if (!Auth::officer()->is_role_or_higher(Officer::ROLE_CONTRACTING_OFFICER)) {
         // @todo add instructions for contacting admin to get verified
         Helper::flash_errors('Sorry, you haven\'t been verified as a contracting officer on RFP-EZ yet. Please <a href="mailto:rfpez@gsa.gov">email us</a> to complete verification.');
         return Redirect::to_route('project_repost_on_fbo', array($project->id));
     }
     // send update emails to all bidders
     $project->send_amendment_emails();
     // record amendment text as a section of the post (under the header "Amendments")
     $section_input = Input::get('amendment_description');
     $section = new ProjectSection($section_input);
     $section->body = htmLawed($section->body, array('safe' => true));
     $section->created_by_project_id = $project->id;
     $section->save();
     // do we want this too? unclear
     $section->project_types()->attach($project->project_type_id);
     $project->add_section($section->id);
     // turn off "amending" state toggle
     $project->end_amending();
     // update post date
     $project->posted_to_fbo_at = new \DateTime();
     // ... or add a new column "last_amended_at"?
     $project->save();
     return Redirect::to_route('project', array($project->id));
 }
Example #6
0
 public function replace_section($old_section_id, $new_section_id)
 {
     $sections = $this->sections;
     $key = array_search($old_section_id, $sections);
     $sections[$key] = $new_section_id;
     $this->sections = $sections;
     $this->save();
     ProjectSection::change_times_used($old_section_id, -1);
     ProjectSection::change_times_used($new_section_id, 1);
 }