public function resendVerificationRequests($req, $res) { if (!$req->isCli()) { return $res->setCode(404); } $hours = VolunteerHour::findAll(['where' => ['organization' => $req->params('org'), 'approved' => false]]); echo "Resending verification requests for organization\n"; $n = 0; foreach ($hours as $hour) { if ($hour->requestThirdPartyVerification()) { ++$n; } } echo "Sent {$n} verification request(s)\n"; }
/** * Gets the most recent volunteer hours performed by volunteers * or a specific volunteer in this organization. * * @param int $start optional start timestamp bound * @param int $end optional end timestamp bound * @param Volunteer $volunteer optional volunteer to filter hours with * * @return Model\Iterator */ public function hours($start = false, $end = false, Volunteer $volunteer = null) { if (!$start) { $start = 0; } if (!$end) { $end = time(); } $where = $this->hourWhereParams(); $where[] = 'timestamp >= ' . $start; $where[] = 'timestamp <= ' . $end; if ($volunteer) { $where['uid'] = $volunteer->id(); } return VolunteerHour::findAll(['where' => $where, 'sort' => 'timestamp DESC']); }
protected function postSetHook() { if ($this->place_type == self::EXTERNAL && $this->justApproved) { // now that the place is approved // we can request verification of all // unapproved hours reported at this place $hours = VolunteerHour::findAll(['where' => ['organization' => $this->organization, 'place' => $this->id(), 'approved' => false]]); foreach ($hours as $hour) { $hour->requestThirdPartyVerification(); } $this->justApproved = false; } }