/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $market = $this->argument('market');
     $fileName = storage_path() . '/app/' . time() . '.xls';
     file_put_contents($fileName, $this->getHtmlContent($this->argument('url')));
     $reader = PHPExcel_IOFactory::createReader('Excel5');
     $excel = $reader->load($fileName);
     $sheet = $excel->getSheet();
     $i = 2;
     while ($sheet->getCell("A{$i}") != "") {
         $code = $sheet->getCell("B{$i}");
         $name = $sheet->getCell("C{$i}");
         $issue = Issue::where('code', $code)->first();
         if (!$issue) {
             $issue = new Issue();
         }
         $issue->code = $code;
         $issue->name = $name;
         $issue->market = $market;
         if ($issue->getOriginal() != $issue->getAttributes()) {
             $issue->save();
         }
         $i++;
     }
     unlink($fileName);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function file($id)
 {
     $issue = Issue::where('id', '=', $id)->pluck('title');
     //dd($issue);
     $files = File::whereissue_id($id)->get();
     return view('public_journal.file', compact('files', 'issue'));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $issues = Issue::all();
     $checkIssueList = array();
     foreach ($issues as $issue) {
         $stockPricelInfos = $issue->stockPricelInfos()->where('average_75days', '!=', 0)->orderBy('acquire_at', 'DESC')->take($this->numberOfVectors)->get();
         if (count($stockPricelInfos) < 2) {
             continue;
         }
         $vectors = array();
         $i = 0;
         foreach ($stockPricelInfos as $stockPricelInfo) {
             $vectors[] = ['x' => count($stockPricelInfos) - $i, 'y' => $stockPricelInfo->average_75days];
             $i++;
         }
         $cls = new CalcLeastSquare($vectors);
         $stockPricelInfos[0]->gradient_75days = $cls->getGradient();
         $stockPricelInfos[0]->save();
         if ($stockPricelInfos[1]->gradient_75days < 0 && $stockPricelInfos[0]->gradient_75days >= 0) {
             $issue->price_up_to_date = $stockPricelInfos[0]->opening_price;
             $checkIssueList[] = $issue;
         }
     }
     if (!count($checkIssueList)) {
         return;
     }
     $mailBody = "";
     foreach ($checkIssueList as $issue) {
         $mailBody .= $issue->code . " " . $issue->name . " ¥" . number_format($issue->unit * $issue->price_up_to_date) . ' http://stocks.finance.yahoo.co.jp/stocks/chart/?code=' . $issue->code . "&ct=z&t=1y&q=c&l=off&z=m&p=s,m75,m25&a=v\n";
     }
     mb_send_mail($this->mailTo, '75日トレンド転換面柄', $mailBody);
 }
示例#4
0
 public function destroy($id)
 {
     $issue = Issue::findOrFail($id);
     $issue->state = -1;
     $issue->ownerDatetime = date('Y-m-d');
     $issue->save();
     return response()->json($issue);
 }
示例#5
0
 /**
  * Get the list of issues in a sprint by issue status
  * @param string $issueStatusMachineName
  * @param int $sprintId
  */
 public static function getIssuesInSprintByIssueStatus($issueStatusMachineName, $sprintId)
 {
     $statusId = IssueStatus::getIdByMachineName($issueStatusMachineName);
     if ($statusId) {
         return Issue::where('sprint_id', '=', $sprintId)->where('status_id', '=', $statusId)->get();
     } else {
         return false;
     }
 }
示例#6
0
 public function addvote(Request $request)
 {
     $current_issue = Issue::where("id", "=", $request->issue_id)->get()->first();
     $votes = $current_issue->total_votes;
     $votes++;
     $current_issue->total_votes = $votes;
     $current_issue->save();
     return $current_issue->total_votes;
 }
 public function upload(StoreIssuePostRequest $request)
 {
     try {
         $city = $this->city->firstOrCreate(['name' => Input::get('city')]);
         $issue = new Issue();
         $issue->city_id = $city->id;
         $issue->email = Input::get('email');
         $issue->comment = Input::get('comment');
         $issue->username = Input::get('username');
         $issue->status_id = Status::$OPEN;
         $issue->facebook_id = Input::get('facebook_id');
         $issue->category_id = Input::get('category_id');
         $lonlat = Input::get('lonlat');
         $issue->geom = DB::raw("ST_GeomFromText('POINT({$lonlat})', 4326)");
         $issue->image_path = $issue->upload(Input::file('file'));
         return $issue->save() ? 'Parabéns! Problema reportado.' : 'Ops, saiu algo errado... x_x';
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
示例#8
0
 public function createissue(Request $request)
 {
     $issue = new Issue();
     $latlng = explode(",", $request->loc);
     $issue->lat = str_replace("(", "", $latlng[0]);
     $issue->lng = str_replace(")", "", $latlng[1]);
     $issue->user_id = $request->city_id;
     $issue->title = $request->title;
     $issue->description = $request->description;
     $issue->status = "N";
     $issue->user_ip = $request->ip();
     $issue->email = $request->email;
     $issue->phone = $request->phone;
     if ($request->file('image')) {
         $imageName = rand(5000, 100000) . '.png';
         $request->file('image')->move(base_path() . '/public/images/issues/', $imageName);
         $issue->image = '/images/issues/' . $imageName;
     }
     $issue->save();
     return $issue;
 }
 public function parseJsonFileToIssues($filename)
 {
     $data = json_decode(file_get_contents($filename), true);
     /*
      * parse issues
      */
     $issues = [];
     foreach ($data['issues'] as $issueData) {
         $issue = new Issue($issueData['title'], $issueData['content'], $this->getUser($issueData['assignee']));
         $issue->parseAndSetState($issueData['status']);
         $issue->setCreatedOn($issueData['created_on']);
         $issue->setReporter($this->getUser($issueData['reporter']));
         if (isset($issueData['priority'])) {
             $issue->addLabel($issueData['priority']);
         }
         if (isset($issueData['kind'])) {
             $issue->addLabel($issueData['kind']);
         }
         $issues[$issueData['id']] = $issue;
     }
     /*
      * Parse comments
      */
     foreach ($data['comments'] as $commentData) {
         if (!empty($commentData['content'])) {
             $issueId = $commentData['issue'];
             $comment = new Comment($commentData['content'], $this->getUser($commentData['user']), $commentData['created_on']);
             /** @var Issue $issue */
             $issue = $issues[$issueId];
             $issue->addComment($comment);
         }
     }
     ksort($issues);
     return $issues;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $issue = new Issue();
     if (!Auth::user()) {
         return Redirect::to(route('auth.getLogin'));
     }
     $input = Input::all();
     $issue->issue_msg = $input['issue'];
     if (array_key_exists('phone', $input)) {
         $issue->phone = $input['phone'];
     } else {
         $issue->phone = "";
     }
     if (array_key_exists('email', $input)) {
         $issue->email = $input['email'];
     } else {
         $issue->email = "";
     }
     $issue->user()->associate(Auth::user());
     $issue->save();
     return redirect(route('home'))->withSuccess("Messaggio inviato correttamente.");
 }
示例#11
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $issues = Issue::with('company', 'company.person')->has('task', '<', 1)->get();
     foreach ($issues as $issue) {
         $task = new Task();
         $task->issue_id = $issue->id;
         $task->person_id = $issue->company->person->id;
         $task->priority = $issue->level * $issue->company->score;
         $task->save();
     }
     $tasks = Task::with('issue', 'issue.company', 'person')->orderBy('priority', 'DESC')->get();
     echo 'ID | Name | Company | Priority | Assigned Person', PHP_EOL;
     foreach ($tasks as $task) {
         echo sprintf('%d | %s | %s | %d | %s', $task->id, $task->issue->name, $task->issue->company->name, $task->priority, $task->person->name), PHP_EOL;
     }
 }
 private function crawlYahoo($baseUrl, $kind)
 {
     $today = date('Y-m-d');
     $yesterday = date('Y-m-d', strtotime((date('N') == 1 ? '-3' : '-1') . ' day'));
     //max page
     $html = $this->getHtmlContent($baseUrl . '1');
     preg_match('#<ul class="ymuiPagingBottom.*?</ul>#ms', $html, $matches);
     preg_match_all('#<a.*?>([0-9]+)</a>#ms', $matches[0], $matches);
     $maxPage = $matches[1][count($matches[1]) - 1];
     $order = 0;
     for ($i = 1; $i <= $maxPage; $i++) {
         $html = $this->getHtmlContent($baseUrl . $i);
         preg_match_all('#<tr class="rankingTabledata yjM">.*?</tr>#ms', $html, $matches);
         foreach ($matches[0] as $row) {
             $order++;
             preg_match('#<a.*?>(.*?)</a>#ms', $row, $matchesTemp);
             $issue = Issue::where('code', $matchesTemp[1])->first();
             if (!$issue) {
                 continue;
             }
             $stockPriceInfo = StockPriceInfo::where('issue_id', $issue->id)->where('acquire_at', $yesterday)->first();
             preg_match('#<td class="txtright">(.*?)</td>#ms', $row, $matchesTemp);
             if ($kind == '75') {
                 $stockPriceInfo->average_75days = str_replace(',', '', $matchesTemp[1]);
             } elseif ($kind == '25') {
                 $stockPriceInfo->average_25days = str_replace(',', '', $matchesTemp[1]);
             }
             $stockPriceInfo->save();
             if ($kind == '75') {
                 preg_match('#<td class="txtright bold">(.*?)</td>#ms', $row, $matchesTemp);
                 $ranking75LowDiremption = new Ranking75LowDiremption();
                 $ranking75LowDiremption->acquire_at = $today;
                 $ranking75LowDiremption->order = $order;
                 $ranking75LowDiremption->issue_id = $issue->id;
                 $ranking75LowDiremption->price = str_replace(',', '', $matchesTemp[1]);
                 $ranking75LowDiremption->save();
             }
         }
     }
 }
示例#13
0
 public function storeclose(Request $request)
 {
     $issue = Issue::findOrFail($request->get('issue_id'));
     $issue->status = "已結案";
     $issue->save();
     return \Redirect::to('issue/show/' . $issue->id)->with('message', 'Your Issue has been updated!');
 }
示例#14
0
 public function generate()
 {
     ini_set("max_execution_time", 0);
     if (Auth::user()->role == "Project Manager") {
         $activities = Activity::whereIn('action', array('Created', 'Deleted', 'Updated'))->where(function ($query) {
             return $query->where('action', '!=', 'Created')->orWhere('type', '!=', 'Deliverable');
         })->where('user_id', Auth::user()->id)->get();
         $projects = Project::where('user_id', Auth::user()->id)->get();
         $projectids = array_pluck($projects, 'id');
         $milestones = Milestone::whereIn('project_id', $projectids)->get();
         $accomplishments = Accomplishment::whereIn('project_id', $projectids)->get();
         $issues = Issue::whereIn('project_id', $projectids)->get();
         $risks = Risk::whereIn('project_id', $projectids)->get();
         $expenses = Expense::whereIn('project_id', $projectids)->get();
         $actions = Action::whereIn('project_id', $projectids)->get();
         $deliverables = Deliverable::whereIn('project_id', $projectids)->get();
         $business_project_team_members = BusinessProjectTeamMember::whereIn('project_id', $projectids)->get();
         $technical_project_team_members = TechnicalProjectTeamMember::whereIn('project_id', $projectids)->get();
         $support_team_members = SupportTeamMember::whereIn('project_id', $projectids)->get();
         return view('audit.generate', compact('activities', 'projects', 'milestones', 'accomplishments', 'issues', 'risks', 'expenses', 'actions', 'deliverables', 'business_project_team_members', 'technical_project_team_members', 'support_team_members'));
     } elseif (Auth::user()->role == "System Administrator") {
         $activities = Activity::whereIn('action', array('Created', 'Deleted', 'Updated'))->where(function ($query) {
             return $query->where('action', '!=', 'Created')->orWhere('type', '!=', 'Deliverable');
         })->get();
         $projects = Project::all();
         $milestones = Milestone::all();
         $accomplishments = Accomplishment::all();
         $issues = Issue::all();
         $risks = Risk::all();
         $users = User::all();
         $expenses = Expense::all();
         $actions = Action::all();
         $deliverables = Deliverable::all();
         $business_project_team_members = BusinessProjectTeamMember::all();
         $technical_project_team_members = TechnicalProjectTeamMember::all();
         $support_team_members = SupportTeamMember::all();
         return view('audit.generate', compact('activities', 'projects', 'milestones', 'accomplishments', 'issues', 'risks', 'users', 'expenses', 'actions', 'deliverables', 'business_project_team_members', 'technical_project_team_members', 'support_team_members'));
     } else {
         flash()->error('You are not authorized to proceed.');
         return redirect()->action('ProjectsController@index');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function issues($id)
 {
     $issues = Issue::wherevolume_id($id)->get();
     return view('public_journal.issues', compact('issues'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $issue = Issue::whereid($id)->firstOrfail();
     $issue->delete();
     return redirect('/issue')->with('status', 'issue deleted successfully');
 }
示例#17
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $issue = Issue::find($id);
     return $issue;
 }
示例#18
0
 /**
  * sortorder Set sort order (sort_prev and sort_next) for an issue when its dragged and dropped into
  * the same sprint
  * @return $result array
  */
 public function sortorder()
 {
     $result = "There was an error updating the issue's sort order";
     $issueId = (int) trim(Request::get('issueId'));
     $projectId = (int) trim(Request::get('projectId'));
     if (Request::get('newPrevIssueId')) {
         $newPrevIssueIdInSprint = trim(strip_tags(Request::get('newPrevIssueId')));
     } else {
         $newPrevIssueIdInSprint = NULL;
     }
     if (Request::get('newNextIssueId')) {
         $newNextIssueIdInSprint = trim(strip_tags(Request::get('newNextIssueId')));
     } else {
         $newNextIssueIdInSprint = NULL;
     }
     // @todo check if the above prev. and next issues are actually in the same sprint as issue
     $issue = Issue::findOrFail($issueId);
     // Update sort order for current previous and next issues in the sprint
     $currentPrevIssue = Sprint::findOrFail($issue->sprint_id)->getPreviousIssueBySortOrder($issueId);
     $currentNextIssue = Sprint::findOrFail($issue->sprint_id)->getNextIssueBySortOrder($issueId);
     if ($currentPrevIssue) {
         $currentPrevIssue->sort_next = $issue->sort_next ? $issue->sort_next : NULL;
         $currentPrevIssue->save();
     }
     if ($currentNextIssue) {
         $currentNextIssue->sort_prev = $issue->sort_prev ? $issue->sort_prev : NULL;
         $currentNextIssue->save();
     }
     // Update sort order for new previous and next issues in the sprint
     if ($newPrevIssueIdInSprint) {
         $newPrevIssue = Issue::findOrFail($newPrevIssueIdInSprint);
         $newPrevIssue->sort_next = $issueId;
         $newPrevIssue->save();
     }
     if ($newNextIssueIdInSprint) {
         $newNextIssue = Issue::findOrFail($newNextIssueIdInSprint);
         $newNextIssue->sort_prev = $issueId;
         $newNextIssue->save();
     }
     // Update sort previous and next for issue
     DB::update('update issues set sort_prev = ?, sort_next = ? where id = ?', [$newPrevIssueIdInSprint, $newNextIssueIdInSprint, $issueId]);
     $result = "Issue's sort order has been updated successfully.";
     return $result;
 }
示例#19
0
 public function generate($id)
 {
     ini_set("max_execution_time", 0);
     $project = Project::find($id);
     $accomplishments = Accomplishment::where('project_id', $id)->get();
     $actions = Action::where('project_id', $id)->get();
     $expenses = Expense::where('project_id', $id)->get();
     $issues = Issue::where('project_id', $id)->get();
     $milestones = Milestone::where('project_id', $id)->get();
     $risks = Risk::where('project_id', $id)->get();
     $lastUser = $project->users->last();
     return view('projects.generate', compact('project', 'actions', 'accomplishments', 'expenses', 'issues', 'milestones', 'risks', 'lastUser'));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $today = date('Y-m-d');
     $yesterday = date('Y-m-d', strtotime((date('N') == 1 ? '-3' : '-1') . ' day'));
     $issues = Issue::all();
     foreach ($issues as $issue) {
         $stockPriceInfoToday = new StockPriceInfo();
         $stockPriceInfoToday->acquire_at = $today;
         $stockPriceInfoYesterday = StockPriceInfo::where('issue_id', $issue->id)->where('acquire_at', $yesterday)->first();
         if (!$stockPriceInfoYesterday) {
             $stockPriceInfoYesterday = new StockPriceInfo();
             $stockPriceInfoYesterday->acquire_at = $yesterday;
         }
         $html = $this->getHtmlContent($this->getUrl($issue->code));
         $ret = preg_match_all('#<dl.*?</dl>#ms', $html, $matches);
         foreach ($matches[0] as $element) {
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">単元株数#ms', $element, $matchesTemp)) {
                 $issue->unit = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">前日終値#ms', $element, $matchesTemp)) {
                 $stockPriceInfoYesterday->closing_price = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">始値#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->opening_price = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">高値#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->high_price = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">安値#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->low_price = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">出来高#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->traded_volume = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">発行済株式数#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->number_of_stocks = intval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>([^<]+)</strong>.*<dt class="title">配当利回り#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->dividend_yield = floatval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<a[^>]+?>([^<]+)</a>.*1株配当#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->dividend_per_stock = floatval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>.*?([^<()]+)</strong>.*<dt class="title">PER#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->per = floatval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<strong>.*?([^<()]+)</strong>.*<dt class="title">PBR#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->pbr = floatval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<a[^>]+?>.*?([^<()]+)</a>.*EPS#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->eps = floatval(str_replace(',', '', $matchesTemp[1]));
             }
             if (preg_match('#<a[^>]+?>.*?([^<()]+)</a>.*BPS#ms', $element, $matchesTemp)) {
                 $stockPriceInfoToday->bps = floatval(str_replace(',', '', $matchesTemp[1]));
             }
         }
         if ($issue->getOriginal() != $issue->getAttributes()) {
             $issue->save();
         }
         $issue->stockPricelInfos()->save($stockPriceInfoToday);
         $issue->stockPricelInfos()->save($stockPriceInfoYesterday);
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $issues = Issue::lists('title', 'id');
     $file = File::findOrFail($id);
     return view('file.edit', compact('file', 'issues'));
 }
示例#22
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($project_id, $id)
 {
     $issue = Issue::find($id);
     $issue->delete();
     flash()->success('Issue has been successfully deleted!');
     return redirect()->action('ProjectsController@show', $project_id);
 }
示例#23
0
 public function postIssue(Request $request)
 {
     $issue = new Issue($request->input());
     $issue->save();
     return redirect('/issue/add-issue');
 }
示例#24
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Issue::destroy($id);
     \Session::flash('status', 'The issue has been removed successfully');
     return '1';
 }
示例#25
0
 public function changeissuestatus(Request $request)
 {
     $current_issue = Issue::where("id", "=", $request->issue_id)->get()->first();
     $current_issue->is_public = $request->status;
     $current_issue->save();
     return $current_issue->is_public;
 }
 /**
  * @param int $issueId
  * @param Issue $issue
  */
 public function updateIssue($issueId, Issue $issue)
 {
     $data = ['state' => $issue->getState()];
     $this->post('issues/' . $issueId, $data);
 }
示例#27
0
 /**
  * Upload image from drag and drop
  */
 public function photoUpload(Request $request)
 {
     $id = $request->input('id');
     $role = $request->input('role');
     if ($request->hasFile('photo')) {
         $file = $request->file('photo');
         $fileName = time() . $file->getClientOriginalName();
         $filePath = config('web.uploadPath') . $fileName;
         $file->move(config('web.uploadPath'), $fileName);
         $data = ['areaID' => $id, 'photo' => $filePath, 'ownerComment' => 'Not commend Yet'];
         Issue::create($data);
         $currentIssue = Issue::orderBy('ID', 'DESC')->first();
         $areaID = $id;
         return view('_partials.issues.show', compact('areaID', 'currentIssue', 'role'));
     }
 }
示例#28
0
 /**
  * Update the sprint associated with an issue
  * @todo create a function to get sprint machine names for a given project
  */
 public function sprintchange()
 {
     $result = "There was an error updating the issue's sprint association";
     $issueId = (int) trim(Request::get('issueId'));
     $projectId = (int) trim(Request::get('projectId'));
     $issue = Issue::find($issueId);
     $machineNameOfNewSprint = trim(strip_tags(Request::get('machineNameOfNewSprint')));
     $sprints = Project::find($issue->project_id)->getSprints();
     $sprintMachineNames = [];
     foreach ($sprints as $sprint) {
         array_push($sprintMachineNames, $sprint->machine_name);
     }
     if (in_array($machineNameOfNewSprint, $sprintMachineNames)) {
         $sprintId = (int) Sprint::where('machine_name', '=', $machineNameOfNewSprint)->where('project_id', '=', $projectId)->first()->id;
         DB::update('update issues set sprint_id = ? where id = ?', [$sprintId, $issueId]);
         $result = "Issue's sprint association has been updated successfully.";
     }
     return $result;
 }