Example #1
0
 public function action_create()
 {
     $project_input = Input::get('project');
     if ($project_input["project_type_id"] == "Other") {
         if (!Input::get('new_project_type_name')) {
             Session::flash('errors', array(__("r.flashes.new_project_no_project_type")));
             return Redirect::to_route('new_projects')->with_input();
         } elseif ($existing_project_type = ProjectType::where_name(Input::get('new_project_type_name'))->first()) {
             $project_input["project_type_id"] = $existing_project_type->id;
         } else {
             $project_type = new ProjectType(array('name' => Input::get('new_project_type_name')));
             $project_type->save();
             $project_input["project_type_id"] = $project_type->id;
         }
     }
     $project = new Project($project_input);
     $dt = new \DateTime($project_input["proposals_due_at"], new DateTimeZone('America/New_York'));
     // if user doesn't specify a date, set it to 1 month from now
     if (!$project_input["proposals_due_at"]) {
         $dt->modify('+1 month');
     }
     $dt->setTimeZone(new DateTimeZone('UTC'));
     $project->proposals_due_at = $dt;
     if ($project->validator()->passes()) {
         $project->save();
         $project->officers()->attach(Auth::officer()->id, array('owner' => true));
         return Redirect::to_route('project_template', array($project->id));
     } else {
         Session::flash('errors', $project->validator()->errors->all());
         return Redirect::to_route('new_projects')->with_input();
     }
 }
Example #2
0
 /**
  * Sets the project object on the class protected var $projectType
  *
  * @param object, object
  *
  * @return void || function()
  */
 public function setProjectType($route, $request)
 {
     $project_type = $route->getParameter('project_type');
     $projectType = ProjectType::where('project_id', $this->project->id)->where('type', $project_type)->first();
     if ($projectType != null) {
         $this->projectType = $projectType;
     } else {
         return $this->getAPIMissing();
     }
 }
Example #3
0
 /**
  * Create project types group
  *
  * @param $project_id integer
  * @param $tableName string
  *
  * @return object
  */
 public static function createTypesGroup($project_id, $tableName)
 {
     $tableName = strtolower($tableName);
     $project = Project::where('id', $project_id)->first();
     if ($project === null) {
         throw new Exception('Project not found');
     }
     $projectType = ProjectType::create(['project_id' => $project->id, 'type' => $tableName, 'table_name' => $project->name . '_' . $tableName]);
     Schema::create($projectType->table_name, function ($table) {
         $table->increments('id');
     });
     return $projectType;
 }
Example #4
0
 public function getProjectPhasesByTypeId($type_id = NULL, $phase_type = 'default')
 {
     if (empty($type_id)) {
         return '';
     }
     $project_type = ProjectType::find($type_id);
     if (!$project_type) {
         return '';
     } else {
         switch ($phase_type) {
             case 'media':
                 return $project_type->media_phases;
                 break;
             case 'default':
             default:
                 return $project_type->phases;
                 break;
         }
     }
 }
Example #5
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 #6
0
 /**
  * ProjectType::deleteAllTypesTables()
  *
  */
 public function testDeleteAllTypesTablesTrue()
 {
     $this->setVars();
     $response = ProjectType::deleteAllTypesTables($this->project->id);
     $this->assertEquals(true, $response);
 }
Example #7
0
 /**
  * Print the computer form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $DB;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Creation date') . "</td>";
     echo "<td>";
     $date = $this->fields["date"];
     if (!$ID) {
         $date = $_SESSION['glpi_currenttime'];
     }
     Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
     echo "</td>";
     if ($ID) {
         echo "<td>" . __('Last update') . "</td>";
         echo "<td >" . Html::convDateTime($this->fields["date_mod"]) . "</td>";
     } else {
         echo "<td colspan='2'>&nbsp;</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'name');
     echo "</td>";
     echo "<td>" . __('Code') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'code');
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Priority') . "</td>";
     echo "<td>";
     CommonITILObject::dropdownPriority(array('value' => $this->fields['priority'], 'withmajor' => 1));
     echo "</td>";
     echo "<td>" . __('As child of') . "</td>";
     echo "<td>";
     $this->dropdown(array('entity' => $this->fields['entities_id'], 'value' => $this->fields['projects_id'], 'used' => array($this->fields['id'])));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('item', 'State') . "</td>";
     echo "<td>";
     ProjectState::dropdown(array('value' => $this->fields["projectstates_id"]));
     echo "</td>";
     echo "<td>" . __('Percent done') . "</td>";
     echo "<td>";
     Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 5, 'unit' => '%'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ProjectType::dropdown(array('value' => $this->fields["projecttypes_id"]));
     echo "</td>";
     echo "<td>" . __('Show on global GANTT') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("show_on_global_gantt", $this->fields["show_on_global_gantt"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr><td colspan='4' class='subheader'>" . __('Manager') . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id', 'value' => $this->fields["users_id"], 'right' => 'see_project', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id', 'value' => $this->fields['groups_id'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_manager`'));
     echo "</td></tr>\n";
     echo "<tr><td colspan='4' class='subheader'>" . __('Planning') . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned start date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("plan_start_date", array('value' => $this->fields['plan_start_date']));
     echo "</td>";
     echo "<td>" . __('Real start date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("real_start_date", array('value' => $this->fields['real_start_date']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned end date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("plan_end_date", array('value' => $this->fields['plan_end_date']));
     echo "</td>";
     echo "<td>" . __('Real end date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("real_end_date", array('value' => $this->fields['real_end_date']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned duration');
     echo Html::showTooltip(__('Sum of planned durations of tasks'));
     echo "</td>";
     echo "<td>";
     echo Html::timestampToString(ProjectTask::getTotalPlannedDurationForProject($this->fields['id']), false);
     echo "</td>";
     echo "<td>" . __('Effective duration');
     echo Html::showTooltip(__('Sum of total effective durations of tasks'));
     echo "</td>";
     echo "<td>";
     echo Html::timestampToString(ProjectTask::getTotalEffectiveDurationForProject($this->fields['id']), false);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Description') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea id='content' name='content' cols='90' rows='6'>" . $this->fields["content"] . "</textarea>";
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Comments') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea id='comment' name='comment' cols='90' rows='6'>" . $this->fields["comment"] . "</textarea>";
     echo "</td>";
     echo "</tr>\n";
     $this->showFormButtons($options);
     return true;
 }
Example #8
0
	</head>
	<body>
		
		<table style="width:100%;background:black;font-family:arial;color:white;padding:30px;" >
			<tr>
				<td><img src="http://vvfy.me/img/gambar.png"></td>
				<td></td>
				<td></td>
			</tr>
			<tr >
				<td style="padding:20px">
					<p style="color:white !important">
					Thanks for submiting your data :)<br><br>

					<?php 
$pt = ProjectType::model()->findByPk($data->project_type)->name;
$reference = $data->reference == 1 ? "Conceptual Renders" : $data->reference == 2 ? "Realistic Renders" : "Highest Quality Renders";
$deadline = $data->deadline;
$style = $data->project_style == 1 ? "Modern" : "Classic";
$productType = ProductType::model()->findByPk($data->product_type)->name;
?>

					Project type : <?php 
echo $pt;
?>
<br>
					<?php 
if ($data->project_type == 1) {
    ?>
						Views count : <?php 
    echo $data->views_count;
Example #9
0
 function view($id = FALSE)
 {
     $this->view_data['submenu'] = array();
     $this->view_data['project_type'] = ProjectType::find($id);
     $this->content_view = 'projects/types/view';
 }
Example #10
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 #11
0
 function create()
 {
     if ($_POST) {
         unset($_POST['send']);
         unset($_POST['files']);
         $_POST['reference_photo'] = '';
         $config['upload_path'] = './files/media/projects/references/';
         $config['encrypt_name'] = TRUE;
         $config['allowed_types'] = '*';
         $this->load->library('upload', $config);
         if ($this->upload->do_upload()) {
             $data = array('upload_data' => $this->upload->data());
             $_POST['reference_photo'] = $data['upload_data']['file_name'];
         }
         unset($_POST['userfile']);
         unset($_POST['dummy']);
         $_POST['datetime'] = time();
         $_POST['company_id'] = $this->client->company->id;
         $_POST = array_map('htmlspecialchars', $_POST);
         $_POST['phases'] = $this->projectlib->getProjectPhasesByTypeId($_POST['project_type_id']);
         $_POST['media_phases'] = $this->projectlib->getProjectPhasesByTypeId($_POST['project_type_id'], 'media');
         $project = Project::create($_POST);
         $new_project_reference = $_POST['reference'] + 1;
         $project_reference = Setting::first();
         $project_reference->update_attributes(array('project_reference' => $new_project_reference));
         if (!$project) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_project_error'));
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_project_success'));
             //$attributes = array('project_id' => $project->id, 'user_id' => $this->user->id);
             //ProjectHasWorker::create($attributes);
         }
         redirect('cprojects');
     } else {
         $this->view_data['companies'] = Company::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['project_types'] = ProjectType::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['shipping_methods'] = ShippingMethod::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['next_reference'] = Project::last();
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_create_project');
         $this->view_data['form_action'] = 'cprojects/create';
         $this->content_view = 'projects/_cproject';
     }
 }
Example #12
0
 /**
  * Handles POST requests for /project/{project_id}/{project_type}/delete-field
  *
  * @return json
  */
 public function postProjectDeleteField($project_id, $project_type)
 {
     $column = isset($this->input['column']) ? $this->input['column'] : false;
     $project = Project::where('id', $project_id)->first();
     $state = ProjectType::removeTypesFields($project, $project_type, $column);
     if ($state) {
         $state = ['error' => false, 'message' => 'Deleted field successfully.'];
     } else {
         $state = ['error' => true, 'message' => 'Failed to delete field.'];
     }
     return Response::json($state);
 }
Example #13
0
 function update($id = FALSE)
 {
     if ($_POST) {
         unset($_POST['send']);
         $id = $_POST['id'];
         unset($_POST['files']);
         $project = Project::find($id);
         $_POST['reference_photo'] = $project->reference_photo;
         if (!empty($_FILES['userfile']['name'])) {
             $config['upload_path'] = self::UPLOAD_PATH;
             $config['encrypt_name'] = TRUE;
             $config['allowed_types'] = '*';
             $this->load->library('upload', $config);
             if ($this->upload->do_upload()) {
                 $data = array('upload_data' => $this->upload->data());
                 $_POST['reference_photo'] = $data['upload_data']['file_name'];
                 if (!empty($project->reference_photo)) {
                     @unlink(self::UPLOAD_PATH . $project->reference_photo);
                 }
             }
         }
         $_POST = array_map('htmlspecialchars', $_POST);
         if (!isset($_POST["progress_calc"])) {
             $_POST["progress_calc"] = 0;
         }
         $_POST['phases'] = $this->projectlib->getProjectPhasesByTypeId($_POST['project_type_id']);
         $_POST['media_phases'] = $this->projectlib->getProjectPhasesByTypeId($_POST['project_type_id'], 'media');
         $project->update_attributes($_POST);
         if (!$project) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_project_error'));
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_save_project_success'));
         }
         redirect('projects/view/' . $id);
     } else {
         $this->view_data['companies'] = Company::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['project_types'] = ProjectType::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['project'] = Project::find($id);
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_edit_project');
         $this->view_data['form_action'] = 'projects/update';
         $this->content_view = 'projects/_project';
     }
 }
 public function testHasName()
 {
     $this->assertEquals('app_project', $this->type->getName());
 }
Example #15
0
 /**
  * Handles GET requests for /project/{project_id}/{project_type}/edit
  *
  * @param int
  *
  * @return view
  */
 public function getProjectTypeEdit($project_id, $project_type)
 {
     $projectType = ProjectType::where('project_id', $project_id)->where('type', $project_type)->first();
     return View::make('layouts.type-edit')->with(['fields' => json_decode($projectType->fields)]);
 }
Example #16
0
File: new.php Project: ajb/rfpez
          <span class="add-on">
            <i class="icon-calendar"></i>
          </span>
        </span>
        <p>
          <em><?php 
echo __("r.projects.new.no_date");
?>
</em>
        </p>
      </div>
      <div class="control-group">
        <label>Project Type</label>
        <select id="project-type-select" name="project[project_type_id]">
          <?php 
foreach (ProjectType::defaults() as $project_type) {
    ?>
            <option value="<?php 
    echo e($project_type->id);
    ?>
"><?php 
    echo e($project_type->name);
    ?>
</option>
          <?php 
}
?>
          <option value="Other">Other</option>
        </select>
        <input id="new-project-type-input" class="hide" type="text" name="new_project_type_name" />
      </div>
Example #17
0
			
			<div id="menu-instant-offer" class="cont-instant-offer">
				<?php 
$calc = new CalculationHead();
$det_calc = new CalculationDetail();
$form = $this->beginWidget('CActiveForm', array('id' => 'calc-form', 'enableAjaxValidation' => false, 'enableClientValidation' => true, 'method' => 'POST', 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true, 'validateOnType' => false)));
?>
				<div class="wrapper-calc">
					<div class="table-leftmenu">
						<div class="row">

							<div class="label"><span class="helper">Project Type</span></div>
							<div class="value">
								<?php 
echo $form->dropDownList($calc, 'project_type', CHtml::listData(ProjectType::model()->findAll(), 'id', 'name'), array('empty' => 'Choose Project Type', 'class' => 'project-type'));
?>
					<!-- 			<select class="project-type">
									<option>Choose Project Type</option>
									<option><?php 
echo OPT_ARCHITECTURE;
?>
</option>
									<option><?php 
echo OPT_INTERIOR;
?>
</option>
									<option><?php 
echo OPT_ARCHITECTURE_AND_INTERIOR;
?>
</option>