public function get_update() { $testimonial = Testimonial::Find($this->testimonial_id); $organisations = Organisation::get(); $selected_org = array(); foreach ($post->organisations as $o) { $selected_org[] = $o->id; } return View::Make('user.testimonials.update')->with('testimonial', $testimonial)->with('organisations', $organisations)->with('selected_org', $selected_org); }
public function get_update() { $category = Category::find($this->category_id); $organisations = Organisation::get(); $selected_org = array(); foreach ($category->organisations as $o) { $selected_org[] = $o->id; } return View::Make('user.categories.update')->with('category', $category)->with('organisations', $organisations)->with('selected_org', $selected_org); }
public function get_update() { $gallery = Gallery::Find($this->gallery_id); $organisations = Organisation::get(); $selected_org = array(); foreach ($gallery->organisations as $o) { $selected_org[] = $o->id; } return View::Make('user.galleries.update')->with('gallery', $gallery)->with('organisations', $organisations)->with('selected_org', $selected_org); }
public function run() { $faker = Faker::create(); foreach (Organisation::get() as $org) { foreach (range(1, $faker->numberBetween(1, 10)) as $index) { $learner = new Learner(['name' => $faker->name, 'identifier' => $faker->email]); $learner = $org->learners()->save($learner); } } }
public function run() { $faker = Faker::create(); foreach (Organisation::get() as $org) { foreach (range(1, $faker->numberBetween(1, 10)) as $index) { $attribute = new Attr(['name' => $faker->domainWord]); $attribute = $org->attrs()->save($attribute); } } }
public function run() { $faker = Faker::create(); $faker->seed(1234); foreach (Organisation::get() as $org) { foreach (range(1, $faker->numberBetween(1, 10)) as $index) { $tutor = new Tutor(['name' => $faker->name, 'email' => $faker->email, 'password' => 'password']); $tutor = $org->tutors()->save($tutor); } } }
public function get_update() { $page = Page::Find($this->page_id); $user = Auth::user(); $organisations = Organisation::get(); $selected_org = array(); foreach ($page->organisations as $o) { $selected_org[] = $o->id; } return View::Make('user.pages.update')->with('page', $page)->with('user', $user)->with('organisations', $organisations)->with('selected_org', $selected_org); }
public function php($data) { $valid = parent::php($data); $uniquefield = $this->uniquefield; $organisation = Organisation::get()->filter($uniquefield, $data[$uniquefield])->first(); if ($uniquefield && is_object($organisation) && $organisation->isInDB()) { $uniqueField = $this->form->Fields()->dataFieldByName($uniquefield); $this->validationError($uniqueField->id(), sprintf(_t('Member.VALIDATIONORGANISATIONEXISTS', 'An organisation already exists with the same %s'), strtolower($uniquefield)), 'required'); $valid = false; } return $valid; }
protected function processRecord($record, $columnMap, &$results, $preview = false) { //TODO: skip empties $this->extend('preprocess', $record, $columnMap, $results, $preview); $id = parent::processRecord($record, $columnMap, $results, $preview); if ($org = Organisation::get()->byID($id)) { $org->write(); //callback for doing other custom stuff $this->extend('postprocess', $org, $record, $columnMap, $results, $preview); $org->destroy(); unset($org); } return $id; }
public function get_update() { $faq = Faq::find($this->faq_id); $faqcategories = Faqcategory::get(); $organisations = Organisation::get(); $selected = array(); foreach ($faq->faqcategories as $c) { $selected[] = $c->id; } $selected_org = array(); foreach ($faq->organisations as $o) { $selected_org[] = $o->id; } return View::Make('user.faqs.update')->with('faq', $faq)->with('faqcategories', $faqcategories)->with('organisations', $organisations)->with('selected_org', $selected_org)->with('selected', $selected); }
public function get_update() { $post = Post::Find($this->post_id); $user = Auth::user(); $categories = Category::get(); $organisations = Organisation::get(); $selected = array(); foreach ($post->categories as $c) { $selected[] = $c->id; } $selected_org = array(); foreach ($post->organisations as $o) { $selected_org[] = $o->id; } return View::Make('user.posts.update')->with('post', $post)->with('user', $user)->with('categories', $categories)->with('selected', $selected)->with('organisations', $organisations)->with('selected_org', $selected_org); }
* */ if (!defined("PARENT_INCLUDED") || !defined("IN_AAMC_CI")) { exit; } elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) { header("Location: " . ENTRADA_URL); exit; } elseif (!$ENTRADA_ACL->amIAllowed("report", "read", false)) { $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)"; add_error("Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance."); echo display_error(); application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]"); } else { $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/events?" . replace_query(array("section" => "add")), "title" => "Adding Event"); $PROCESSED["organisation_id"] = (int) $ENTRADA_USER->getActiveOrganisation(); $org = Organisation::get($PROCESSED["organisation_id"]); echo "<h1>Create AAMC Curriculum Inventory Report</h1>\n"; // Error Checking switch ($STEP) { case 2: /** * Required field "report_title" / Report Title. */ if (isset($_POST["report_title"]) && ($report_title = clean_input($_POST["report_title"], array("notags", "trim")))) { $query = "SELECT * FROM `reports_aamc_ci` WHERE `report_title` LIKE " . $db->qstr($report_title); $result = $db->GetRow($query); if (!$result) { $PROCESSED["report_title"] = $report_title; } else { add_error("The <strong>Report Title</strong> field that you entered is not unique."); }
protected function getOrganisationFromRequest() { return Organisation::get()->byID((int) $this->request->param('ID')); }
break; case 'update': $opts = filter_input_array(INPUT_POST, array("associated_organisation_id" => FILTER_SANITIZE_NUMBER_INT, "associated_group" => FILTER_SANITIZE_STRING, "associated_role" => FILTER_SANITIZE_STRING, "associated_cat_id" => FILTER_SANITIZE_NUMBER_INT)); if (!$opts["associated_cat_id"]) { add_error("Invalid or unspecified Category."); header("HTTP/1.0 500 Internal Error"); echo display_status_messages(false); exit; } else { $category = MetaDataType::get($opts["associated_cat_id"]); } if (!$opts["associated_organisation_id"]) { add_error("Invalid or unspecified Organisation"); } else { $organisation_id = $opts["associated_organisation_id"]; $organisation = Organisation::get($organisation_id); } if (!$opts["associated_group"]) { add_error("Invalid or unspecified Group"); } else { $group = $opts["associated_group"]; } if ($opts["associated_role"] == "all") { $role = null; } else { $role = $opts["associated_role"]; } if (!has_error()) { $caching = MetaDataValues::get($organisation_id, $group, $role, null, $category); //first go through the values array and verify that all of the indices are correct $indices = filter_var(array_keys($_POST['value']), FILTER_VALIDATE_INT, array("flags" => FILTER_REQUIRE_ARRAY));
exit; } elseif (!$ENTRADA_ACL->amIAllowed("report", "read", false)) { $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)"; add_error("You do not have the permissions required to use this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance."); echo display_error(); application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] do not have access to this module [" . $MODULE . "]"); } else { require_once "Models/utility/Collection.class.php"; require_once "Models/utility/SimpleCache.class.php"; require_once "Models/organisations/Organisation.class.php"; require_once "Models/organisations/Organisations.class.php"; define("IN_AAMC_CI", true); $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/reports/aamc", "title" => "AAMC Curriculum Inventory"); if ($router && $router->initRoute()) { $module_file = $router->getRoute(); if ($module_file) { $org = Organisation::get((int) $ENTRADA_USER->getActiveOrganisation()); if ($org->getAAMCInstitutionId() && $org->getAAMCInstitutionName() && $org->getAAMCProgramId() && $org->getAAMCProgramName()) { require_once $module_file; } else { add_error("Before you are able to generate a AAMC Cirriculum Inventory report you must provide your AAMC institution name and identifier, and program name and identifier on the <a href=\"" . ENTRADA_RELATIVE . "/admin/settings/organisations/manage?org=" . $ENTRADA_USER->getActiveOrganisation() . "&section=edit\">Edit Organisation</a> page."); echo display_error(); } } } else { $url = ENTRADA_URL . "/admin/" . $MODULE; application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "]."); header("Location: " . $url); exit; } }
public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab("Root.Main", DropdownField::create("OrganisationID", "Organisation", Organisation::get()->filter("Name:not", "")->map()->toArray())->setHasEmptyDefault(true)); }
/** * Returns null if the $value provided is not a valid organisation_id; returns the $value otherwise. XXX NOTE, a bug prior to php 5.2.6 causes epic php failure if callbacks return false. null returned as workaround * @param unknown_type $value * @return mixed */ function validate_organisation_id($value) { $organisation_id = filter_var($value, FILTER_VALIDATE_INT, array('min_range' => 1)); if (false === $organisation_id || !Organisation::get($organisation_id)) { return; } else { return $organisation_id; } }
/** * Returns the Organisation to which this department belongs * @return Organisation */ public function getOrganisation() { return Organisation::get($this->organisation_id); }