コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $action = new \App\Action();
     $action->fromJson($request->getContent());
     $user_id = $action->user_id;
     if (!$user_id) {
         $user_id = $request->cookie('tr_guid');
         if (!$user_id) {
             $user_id = $this->as->generateUserId();
         }
         $action->user_id = $user_id;
     }
     $this->as->setRequestData($action, $request);
     $this->as->setDefaults($action);
     try {
         $action->validate();
     } catch (\Exception $e) {
         return $this->error($e);
     }
     $referral_code = $this->as->generateReferralCode($action);
     $action->referral_code = $referral_code;
     try {
         $rv = $this->as->storeAction($action);
     } catch (\Exception $e) {
         return $this->error($e);
     }
     $response_data = ['user_id' => $user_id, 'referral_code' => $referral_code, 'is_new' => $rv['is_new'], 'counter' => $rv['counter'], 'action' => $rv['action']->toArray()];
     $response_json = json_encode($response_data);
     return response($response_json)->header('Content-Type', 'application/json');
 }
コード例 #2
0
ファイル: DynamoDb.php プロジェクト: jacksteadman/tracer2
 public function getActionByUniquenessKey($user_id, $uniqueness_key)
 {
     $response = $this->client->query(['TableName' => 'tr_actions', 'IndexName' => 'uniqueness_key-index', 'KeyConditionExpression' => 'user_id = :user_id AND uniqueness_key = :u_key', 'ExpressionAttributeValues' => [':user_id' => ['S' => $user_id], ':u_key' => ['S' => $uniqueness_key]], 'Limit' => 1]);
     if (!empty($response['Items'])) {
         $action = new \App\Action();
         $action->fromArray($this->marshaler->unmarshalItem($response['Items'][0]));
         return $action;
     }
     return null;
 }
コード例 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('actions')->insert([['description' => 'Review public computing needs and develop strategies to meet those needs.', 'date' => Carbon::createFromDate(2014, 1, 1, 'America/Toronto'), 'collaborators' => 'IT Services Department, DLI', 'budget' => 300, 'successMeasured' => 'Achieve an 90% satisfaction rating; Increase computer usage by 20%', 'progress' => 0, 'objective_id' => 1, 'group' => 1, 'userId' => 1], ['description' => 'Establish a fine-free day to take place every second year.', 'date' => Carbon::createFromDate(2016, 1, 1, 'America/Toronto'), 'collaborators' => 'Marketing', 'budget' => 500, 'successMeasured' => 'The board has approved the proposed day', 'progress' => 0, 'objective_id' => 2, 'group' => 1, 'userId' => 1], ['description' => 'Extend literacy van services to under served communities in Edmonton and surrounding areas.', 'date' => Carbon::createFromDate(2015, 1, 1, 'America/Toronto'), 'collaborators' => 'Marketing', 'budget' => 1200, 'successMeasured' => 'Increased use and knowledge of EPL services in underserved communities', 'progress' => 0, 'objective_id' => 2, 'group' => 1, 'userId' => 1], ['description' => 'Live stream two forward thinking speaker series events in 2016', 'date' => Carbon::createFromDate(2016, 1, 1, 'America/Toronto'), 'collaborators' => 'Marketing, IT Services Department, DLI', 'budget' => 5000, 'successMeasured' => 'Over 500 people watching live and 5,000 video hits.', 'progress' => 2, 'objective_id' => 3, 'group' => 1, 'userId' => 1], ['description' => 'Host EPL Day celebrations at all branches on March 13, 2016.', 'date' => Carbon::createFromDate(2016, 3, 13, 'America/Toronto'), 'collaborators' => 'Marketing, Purchasing', 'budget' => 10000, 'successMeasured' => 'Increase in customer visits year over year', 'progress' => 2, 'objective_id' => 4, 'group' => 2, 'userId' => 1], ['description' => 'Evaluate the 2016 event and create a proposal for the 2017 by November 30, 2016.', 'date' => Carbon::createFromDate(2017, 11, 30, 'America/Toronto'), 'collaborators' => 'Marketing', 'budget' => 100, 'successMeasured' => 'A report consisting of the 2016 was created, and the proposal for the next event was created.', 'progress' => 2, 'objective_id' => 4, 'group' => 2, 'userId' => 2], ['description' => 'Host a guest speaker during Freedom to Read Week related to intellectual freedom', 'date' => Carbon::createFromDate(2016, 2, 25, 'America/Toronto'), 'collaborators' => 'Marketing, Audit Services, Fund Development, Volunteers', 'budget' => 2000, 'successMeasured' => 'Sold out event, full venue and 100% sell through of fund development seats. ', 'progress' => 1, 'objective_id' => 5, 'group' => 2, 'userId' => 4], ['description' => 'Host Reza Aslan to speak on confronting islamaphobia on May 18, 2016', 'date' => Carbon::createFromDate(2016, 5, 18, 'America/Toronto'), 'collaborators' => 'Marketing', 'budget' => 15000, 'successMeasured' => 'Sold out event, full venue and 100% sell through of fund development seats. ', 'progress' => 3, 'objective_id' => 5, 'group' => 2, 'userId' => 3], ['description' => 'Host a TED talk to promote artistic freedom', 'date' => Carbon::createFromDate(2016, 10, 23, 'America/Toronto'), 'collaborators' => 'IT Services Department, Marketing', 'budget' => 20000, 'successMeasured' => 'All public PCs are upgraded to Windows 10 ', 'progress' => 1, 'objective_id' => 5, 'group' => 2, 'userId' => 5], ['description' => 'Review Q3 and Q4 2015 financial status', 'date' => Carbon::createFromDate(2016, 3, 4, 'America/Toronto'), 'collaborators' => 'J McPhee', 'budget' => 100, 'successMeasured' => 'A report on Q3 and Q4 2015 finances of EPL was generated ', 'progress' => 0, 'objective_id' => 2, 'group' => 4, 'userId' => 4], ['description' => 'Promote virtual reality by holding Oculus Rift & HTC Vive publicity events', 'date' => Carbon::createFromDate(2016, 6, 2, 'America/Toronto'), 'collaborators' => 'Jody Crilly', 'budget' => 35000, 'successMeasured' => 'Host 2 events in 2016 where people can demo virtual reality', 'progress' => 0, 'objective_id' => 6, 'group' => 4, 'userId' => 4], ['description' => 'Ask public for feedback on possible logos', 'date' => Carbon::createFromDate(2016, 5, 21, 'America/Toronto'), 'collaborators' => 'Jody Crilly', 'budget' => 200, 'successMeasured' => 'Results of poll are in with at least 1000 participants', 'progress' => 0, 'objective_id' => 8, 'group' => 4, 'userId' => 4], ['description' => 'Design possible EPL logos', 'date' => Carbon::createFromDate(2016, 4, 2, 'America/Toronto'), 'collaborators' => 'Fund Development', 'budget' => 5000, 'successMeasured' => '3 or 4 possible new logos are created', 'progress' => 0, 'objective_id' => 8, 'group' => 4, 'userId' => 4], ['description' => 'Communicate with eBook distributors to gain access to new eBooks', 'date' => Carbon::createFromDate(2016, 8, 2, 'America/Toronto'), 'collaborators' => 'DLI, Purchasing', 'budget' => 5000, 'successMeasured' => '2 or more distributors have been successfully committed to providing eBooks', 'progress' => 0, 'objective_id' => 7, 'group' => 4, 'userId' => 4], ['description' => 'Obtain $40,000 in sponsorships through the FTSS in 2016', 'date' => Carbon::createFromDate(2016, 8, 2, 'America/Toronto'), 'collaborators' => 'DLI, Purchasing', 'budget' => 500, 'successMeasured' => '$40,000 in event sponsorships.', 'progress' => 0, 'objective_id' => 9, 'group' => 4, 'userId' => 4], ['description' => 'Bonus for individuals who display best service in the month', 'date' => Carbon::createFromDate(2016, 4, 2, 'America/Toronto'), 'collaborators' => 'Fund Development', 'budget' => 12000, 'successMeasured' => 'Individuals communicate their happiness with the service', 'progress' => 0, 'objective_id' => 10, 'group' => 4, 'userId' => 4], ['description' => 'Mobile Device Management (MDM) documentation and roll out', 'date' => Carbon::createFromDate(2016, 3, 15, 'America/Toronto'), 'collaborators' => 'DLI', 'budget' => 3400, 'successMeasured' => 'MDM Fully rolled out and documented', 'progress' => 2, 'objective_id' => 13, 'group' => 1, 'userId' => 2], ['description' => 'Test Windows 10 in EPL\'s environment and develop a deployment plan', 'date' => Carbon::createFromDate(2016, 6, 1, 'America/Toronto'), 'collaborators' => 'Active Networks', 'budget' => 2300, 'successMeasured' => 'Development plan created', 'progress' => 1, 'objective_id' => 13, 'group' => 1, 'userId' => 2], ['description' => 'Replace aging equipment per the IT Infrastructure budget', 'date' => Carbon::createFromDate(2016, 9, 30, 'America/Toronto'), 'collaborators' => 'Project Team', 'budget' => 50000, 'successMeasured' => 'Development plan created', 'progress' => 0, 'objective_id' => 13, 'group' => 1, 'userId' => 2], ['description' => 'Support and enhance gaming opportunities for customers at EPL', 'date' => Carbon::createFromDate(2016, 12, 31, 'America/Toronto'), 'collaborators' => 'DLI', 'budget' => 12000, 'successMeasured' => 'More gaming opportunities presented', 'progress' => 0, 'objective_id' => 14, 'group' => 1, 'userId' => 2]]);
     for ($j = 1; $j <= App\Objective::All()->Count(); $j++) {
         global $obj;
         $obj = DB::table('objectives')->where('id', $j)->first();
         for ($i = 1, $k = 1; $i <= App\Action::All()->Count(); $i++) {
             $act = DB::table('actions')->where('id', $i)->first();
             if ($act->objective_id == $obj->id) {
                 DB::table('actions')->where('id', $i)->update(array('ident' => $obj->ident . '.' . $k));
                 $k++;
             }
         }
     }
 }
コード例 #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tasks')->insert([['description' => 'Implement approved recommendations from the 2015 Public Computing Report', 'date' => Carbon::createFromDate(2016, 3, 1, 'America/Toronto'), 'collaborators' => 'IT Project Team', 'budget' => 1000, 'successMeasured' => 'Relevant recommendations have been implemented', 'progress' => 0, 'action_id' => 1, 'group' => 1, 'userId' => 1], ['description' => 'Upgrade LibOnline to the latest version (4.9)', 'date' => Carbon::createFromDate(2016, 1, 1, 'America/Toronto'), 'collaborators' => 'Active Networks', 'budget' => 500, 'successMeasured' => 'All PCs are upgraded to LibOnline 4.9', 'progress' => 0, 'action_id' => 1, 'group' => 1, 'userId' => 2], ['description' => 'Provide planning assistance to the Customer Payments team to implement the necessary changes to support a Fine Free day', 'date' => Carbon::createFromDate(2016, 3, 1, 'America/Toronto'), 'collaborators' => 'Fund Development, Audit Services', 'budget' => 4300, 'successMeasured' => 'Customer Payments team received assistance to implement changes to support a Fine Free day', 'progress' => 0, 'action_id' => 2, 'group' => 1, 'userId' => 2], ['description' => 'Aid in the selection, purchase, and configuration of equipment for the fourth literacy van', 'date' => Carbon::createFromDate(2016, 9, 9, 'America/Toronto'), 'collaborators' => 'Alex Carruthers, Elaine Jones', 'budget' => 4300, 'successMeasured' => 'Fourth literacy van equipment was purchased', 'progress' => 0, 'action_id' => 3, 'group' => 1, 'userId' => 1], ['description' => 'Get speaker for TED talk', 'date' => Carbon::createFromDate(2016, 8, 9, 'America/Toronto'), 'collaborators' => 'Alex Carruthers, Elaine Jones', 'budget' => 10000, 'successMeasured' => 'A speaker has agreed to speak at EPL', 'progress' => 0, 'action_id' => 9, 'group' => 2, 'userId' => 4], ['description' => 'Promote TED talk', 'date' => Carbon::createFromDate(2016, 8, 9, 'America/Toronto'), 'collaborators' => 'Alex Carruthers, Elaine Jones', 'budget' => 10000, 'successMeasured' => 'A speaker has agreed to speak at EPL', 'progress' => 0, 'action_id' => 9, 'group' => 3, 'userId' => 6], ['description' => 'Review Q3 financial status', 'date' => Carbon::createFromDate(2016, 7, 12, 'America/Toronto'), 'collaborators' => 'Purchasing', 'budget' => 150, 'successMeasured' => 'Q3 Financial Status section in document is completed', 'progress' => 0, 'action_id' => 10, 'group' => 5, 'userId' => 4], ['description' => 'Review Q4 financial status', 'date' => Carbon::createFromDate(2016, 7, 13, 'America/Toronto'), 'collaborators' => 'Purchasing', 'budget' => 150, 'successMeasured' => 'Q4 Financial Status section in document is completed', 'progress' => 0, 'action_id' => 10, 'group' => 5, 'userId' => 4], ['description' => 'Purchase VR kits', 'date' => Carbon::createFromDate(2016, 5, 12, 'America/Toronto'), 'collaborators' => 'Vicky Varga', 'budget' => 25000, 'successMeasured' => '10 VR units have been acquired', 'progress' => 1, 'action_id' => 11, 'group' => 7, 'userId' => 5], ['description' => 'Promote VR Event', 'date' => Carbon::createFromDate(2016, 4, 21, 'America/Toronto'), 'collaborators' => 'Vicky Varga', 'budget' => 10000, 'successMeasured' => '10 VR units have been acquired', 'progress' => 1, 'action_id' => 11, 'group' => 3, 'userId' => 5], ['description' => 'Create internal documentation for each profile (i.e. Early literacy and Mini-makerspace) applied to EPL iPads', 'date' => Carbon::createFromDate(2016, 6, 21, 'America/Toronto'), 'collaborators' => 'Purchasing, DLI', 'budget' => 4000, 'successMeasured' => 'Documentation is created and shared with the IT department', 'progress' => 0, 'action_id' => 17, 'group' => 1, 'userId' => 1], ['description' => 'Develop and implement an implementation plan for rolling EPL\'s Mobile Device Management tool out to all pre-existing kit iPads', 'date' => Carbon::createFromDate(2016, 7, 11, 'America/Toronto'), 'collaborators' => 'Volunteers', 'budget' => 5000, 'successMeasured' => 'MDM implemented on all kit laptops', 'progress' => 0, 'action_id' => 17, 'group' => 1, 'userId' => 1], ['description' => 'Complete a cost/benefit analysis of using EPL\'s MDM to secure manager iPads', 'date' => Carbon::createFromDate(2016, 7, 11, 'America/Toronto'), 'collaborators' => 'Volunteers', 'budget' => 3000, 'successMeasured' => 'Report Completed', 'progress' => 0, 'action_id' => 17, 'group' => 1, 'userId' => 1], ['description' => 'Develop a test plan to determine if EPL is ready to move to Windows 10', 'date' => Carbon::createFromDate(2016, 4, 11, 'America/Toronto'), 'collaborators' => 'Volunteers, DLI', 'budget' => 1200, 'successMeasured' => 'Test plan completed and recommendation forwarded', 'progress' => 1, 'action_id' => 18, 'group' => 1, 'userId' => 1], ['description' => 'Determine the budget implications of upgrading to Windows 10', 'date' => Carbon::createFromDate(2016, 4, 11, 'America/Toronto'), 'collaborators' => 'DLI, J McPhee', 'budget' => 100, 'successMeasured' => 'Analysis completed', 'progress' => 1, 'action_id' => 18, 'group' => 1, 'userId' => 1], ['description' => 'Develop a deployment/upgrade plan to migrate to Windows 10 if appropriate', 'date' => Carbon::createFromDate(2016, 4, 11, 'America/Toronto'), 'collaborators' => 'Project Team, Jody Crilly, Elaine Jones', 'budget' => 100, 'successMeasured' => 'Plan completed', 'progress' => 1, 'action_id' => 18, 'group' => 1, 'userId' => 1], ['description' => 'Order monitors, PCs, and laptops due for replacement in 2016', 'date' => Carbon::createFromDate(2016, 3, 31, 'America/Toronto'), 'collaborators' => 'Active Networks, Marketing', 'budget' => 40000, 'successMeasured' => 'Equipment ordered', 'progress' => 2, 'action_id' => 19, 'group' => 1, 'userId' => 1], ['description' => 'Replace 184 monitors ', 'date' => Carbon::createFromDate(2016, 3, 31, 'America/Toronto'), 'collaborators' => 'Fund Development, Active Networks', 'budget' => 20000, 'successMeasured' => 'Monitors deployed', 'progress' => 2, 'action_id' => 19, 'group' => 1, 'userId' => 1], ['description' => 'Replace 237 PCs', 'date' => Carbon::createFromDate(2016, 5, 31, 'America/Toronto'), 'collaborators' => 'Fund Development', 'budget' => 20000, 'successMeasured' => 'PCs deployed', 'progress' => 1, 'action_id' => 19, 'group' => 1, 'userId' => 1], ['description' => 'Replace 32 laptops', 'date' => Carbon::createFromDate(2016, 7, 31, 'America/Toronto'), 'collaborators' => 'DLI, Fund Development', 'budget' => 10000, 'successMeasured' => 'Laptops deployed', 'progress' => 0, 'action_id' => 19, 'group' => 1, 'userId' => 1], ['description' => 'Collaborate with DLI on how to expend the $5356 allocated for replacing aging sandbox devices', 'date' => Carbon::createFromDate(2016, 9, 31, 'America/Toronto'), 'collaborators' => 'DLI, Audit Services', 'budget' => 100, 'successMeasured' => 'Equipment selected and deployed', 'progress' => 0, 'action_id' => 19, 'group' => 1, 'userId' => 1], ['description' => 'Determine how to expend the $4848 allotted for projector upgrades in IT’s capital budget', 'date' => Carbon::createFromDate(2016, 10, 31, 'America/Toronto'), 'collaborators' => 'Purchasing, Fund Development', 'budget' => 100, 'successMeasured' => 'Equipment selected and deployed', 'progress' => 0, 'action_id' => 19, 'group' => 1, 'userId' => 1], ['description' => 'Support the ELF team\'s evaluation of the early literacy iPad pilot and purchase hardware to replace AWE\'s', 'date' => Carbon::createFromDate(2016, 4, 31, 'America/Toronto'), 'collaborators' => 'Project Team, Events Team', 'budget' => 235, 'successMeasured' => 'Hardware purchased and deployed', 'progress' => 1, 'action_id' => 20, 'group' => 1, 'userId' => 1], ['description' => 'Upgrade Minecraft EDU on the public PCs to match the version used on the kit laptops', 'date' => Carbon::createFromDate(2016, 2, 31, 'America/Toronto'), 'collaborators' => 'DLI, Active Networks', 'budget' => 5000, 'successMeasured' => 'Minecraft upgraded', 'progress' => 2, 'action_id' => 20, 'group' => 1, 'userId' => 1], ['description' => 'Complete configurations to allow access to gaming via Steam over WiFi', 'date' => Carbon::createFromDate(2016, 10, 31, 'America/Toronto'), 'collaborators' => 'DLI', 'budget' => 100, 'successMeasured' => 'Steam access allowed', 'progress' => 0, 'action_id' => 20, 'group' => 1, 'userId' => 1], ['description' => 'Provide support for DLI\'s League of Legends tournament pilot', 'date' => Carbon::createFromDate(2016, 8, 31, 'America/Toronto'), 'collaborators' => 'Audit Services', 'budget' => 4000, 'successMeasured' => 'Equipment selected and deployed', 'progress' => 0, 'action_id' => 20, 'group' => 1, 'userId' => 1]]);
     for ($j = 1; $j <= App\Action::All()->Count(); $j++) {
         global $act;
         $act = DB::table('actions')->where('id', $j)->first();
         for ($i = 1, $k = 1; $i <= App\Task::All()->Count(); $i++) {
             $task = DB::table('tasks')->where('id', $i)->first();
             if ($task->action_id == $act->id) {
                 DB::table('tasks')->where('id', $i)->update(array('ident' => $act->ident . '.' . $k));
                 $k++;
             }
         }
     }
 }