本文整理汇总了PHP中Institution类的典型用法代码示例。如果您正苦于以下问题:PHP Institution类的具体用法?PHP Institution怎么用?PHP Institution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Institution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$insts = new Institution();
$instsu = new Institution_usage();
pass_var("insts", $insts->find_all());
pass_var("instsu", $instsu->find_all());
pass_var('title', "Institution Usage Index");
pass_var('message', "List of Institution Usage");
}
示例2: getPostPage
public function getPostPage()
{
$obj = new BaseController();
$campusid = $this->getDevice();
if ($campusid == 0) {
$countryname = $obj->getCountryName();
if ($countryname == 'NONE') {
return Redirect::route('selectcampus-get');
} else {
//check whether the country name exists inthe db
$locationcountry = Country::where('name', '=', $countryname);
if ($locationcountry->count()) {
$locationcountrycode = $locationcountry->first()->code;
$locationcountrycode = strtolower($locationcountrycode);
return Redirect::route('selectcountryid', $locationcountrycode);
} else {
return Redirect::route('selectcampus-get');
}
}
}
$college = Institution::whereHas('Branch', function ($query) use($campusid) {
$query->where('id', '=', $campusid);
})->first();
View::share('college', $college);
$mycampus = Branch::where('id', '=', $campusid)->first();
View::share('mycampus', $mycampus);
if (Auth::user()) {
return View::make('member.post');
}
return View::make('guest.post');
}
示例3: actionEdit
/**
* Edits or adds a Procedure.
*
* @param bool|int $id
*
* @throws CHttpException
*/
public function actionEdit($id = false)
{
if ($id) {
$this->admin->setModelId($id);
}
$this->admin->setEditFields(array('name' => 'text', 'siteLetterStrings' => array('widget' => 'RelationList', 'relation' => 'siteLetterStrings', 'action' => 'OphCoCorrespondence/oeadmin/snippet', 'search' => array('site_id' => array('type' => 'dropdown', 'options' => CHtml::listData(Institution::model()->getCurrent()->sites, 'id', 'short_name'), 'default' => Yii::app()->session['selected_site_id'])), 'listFields' => array('display_order', 'name', 'body', 'element_type.name', 'eventTypeName'))));
$this->admin->editModel();
}
示例4: actionEdit
/**
* Edits or adds a snippets.
*
* @param bool|int $id
*
* @throws CHttpException
*/
public function actionEdit($id = false)
{
if ($id) {
$this->admin->setModelId($id);
}
$this->admin->setEditFields(array('site_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(Institution::model()->getCurrent()->sites, 'id', 'short_name'), 'default' => Yii::app()->request->getParam('site_id'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'letter_string_group_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(LetterStringGroup::model()->findAll(), 'id', 'name'), 'default' => Yii::app()->request->getParam('group_id'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'name' => 'text', 'body' => array('widget' => 'CustomView', 'viewName' => '//admin/generic/shortcodeText', 'viewArguments' => array('model' => $this->admin->getModel())), 'event_type' => array('widget' => 'DropDownList', 'options' => CHtml::listData(EventType::model()->findAll(), 'class_name', 'name'), 'htmlOptions' => array('empty' => '- Select -'), 'hidden' => false, 'layoutColumns' => null), 'element_type' => array('widget' => 'DropDownList', 'options' => CHtml::listData(ElementType::model()->findAll(), 'class_name', 'name'), 'htmlOptions' => array('empty' => '- Select -'), 'hidden' => false, 'layoutColumns' => null)));
$this->admin->editModel();
}
示例5: addSpecializationAction
/**
* Add a new specialization to medical center
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function addSpecializationAction(Request $request)
{
$service = $this->get('services.institution_medical_center');
if ($request->isMethod('POST')) {
$submittedSpecializations = $request->get(InstitutionSpecializationFormType::NAME);
$em = $this->getDoctrine()->getEntityManager();
if (\count($submittedSpecializations) > 0) {
foreach ($submittedSpecializations as $specializationId => $_data) {
$specialization = $this->get('services.treatment_bundle')->getSpecialization($specializationId);
$_institutionSpecialization = new InstitutionSpecialization();
$_institutionSpecialization->setSpecialization($specialization);
$_institutionSpecialization->setInstitutionMedicalCenter($this->institutionMedicalCenter);
$_institutionSpecialization->setStatus(InstitutionSpecialization::STATUS_ACTIVE);
$_institutionSpecialization->setDescription('');
// set passed treatments as choices
$default_choices = array();
if ($_data['treatments'] != '') {
$_treatment_choices = $this->get('services.treatment_bundle')->findTreatmentsByIds($_data['treatments']);
foreach ($_treatment_choices as $_t) {
$default_choices[$_t->getId()] = $_t->getName();
// add the treatment
$_institutionSpecialization->addTreatment($_t);
}
$form = $this->createForm(new InstitutionSpecializationFormType(), $_institutionSpecialization, array('default_choices' => $default_choices));
$form->bind($_data);
if ($form->isValid()) {
$em->persist($_institutionSpecialization);
$em->flush();
// Invalidate InstitutionMedicalCenter Profile cache
$this->get('services.memcache')->delete(FrontendMemcacheKeysHelper::generateInsitutionMedicalCenterProfileKey($this->institutionMedicalCenter->getId()));
// Invalidate Institution Profile cache
$this->get('services.memcache')->delete(FrontendMemcacheKeysHelper::generateInsitutionProfileKey($this->institutionMedicalCenter->getInstitution()->getId()));
return $this->redirect($this->generateUrl('admin_institution_medicalCenter_view', array('institutionId' => $this->institution->getId(), 'imcId' => $this->institutionMedicalCenter->getId())));
} else {
$request->getSession()->setFlash('notice', '<ul><li>Unable to save specializations. Please try again.</li></ul>');
}
} else {
$request->getSession()->setFlash('notice', '<ul><li> Please provide at least one treatment.</li></ul>');
}
}
} else {
$request->getSession()->setFlash('notice', '<ul><li> Please provide at least one specialization.</li></ul>');
}
} else {
$form = $this->createForm(new InstitutionSpecializationSelectorFormType());
$assignedSpecialization = $this->getDoctrine()->getRepository('InstitutionBundle:InstitutionSpecialization')->findByInstitutionMedicalCenter($this->institutionMedicalCenter);
$specializations = $this->getDoctrine()->getRepository('TreatmentBundle:Specialization')->getAvailableSpecializations($assignedSpecialization);
$specializationArr = array();
foreach ($specializations as $e) {
$specializationArr[] = array('value' => $e->getName(), 'id' => $e->getId());
}
}
$params = array('form' => $form->createView(), 'institution' => $this->institution, 'institutionMedicalCenter' => $this->institutionMedicalCenter, 'selectedSubMenu' => 'centers', 'specializationsJSON' => \json_encode($specializationArr));
return $this->render('AdminBundle:InstitutionSpecialization:addSpecializations.html.twig', $params);
}
示例6: reservationName
function reservationName($reservation)
{
if ($reservation->CreditorType == 2) {
return Institution::find($reservation->CreditorId)->Name;
} else {
if ($reservation->CreditorId != 0) {
return Client::find($reservation->CreditorId)->Name;
} else {
return 'No declarado';
}
}
}
示例7: get_logged_company
function get_logged_company()
{
if (!$this->is_signed_in()) {
return NULL;
} else {
if ($this->CI->session->userdata('company_id') || $this->CI->session->userdata('institution_id')) {
$c = new Company();
$c->where('id', $this->CI->session->userdata('company_id'))->get();
if ($c->exists()) {
return $c;
} else {
$c = new Institution();
$c->where('id', $this->CI->session->userdata('institution_id'))->get();
if ($c->exists()) {
return $c;
}
}
}
return NULL;
}
}
示例8: delete
public static function delete($id)
{
if (self::get_user_admin() == null) {
Redirect::to('/home');
}
$degrees = Degree::findByInstitution($id);
if (!empty($degrees)) {
Redirect::to('/institutions', array('error' => 'Institution could not be deleted, because it is linked to one or more degrees. First delete related degrees under Manage->Degrees.'));
}
$institution = Institution::find($id);
$institution->delete();
Redirect::to('/institutions', array('message' => 'Institution deleted!'));
}
示例9: add
function add()
{
// Is logged in?
$this->session = new Session();
if (!$this->session->get('email') && !$this->session->get('id')) {
die(redirect(''));
}
$r = new Realm();
$r = $r->find_all();
$rids = array();
foreach ($r as $realm) {
$rids[$realm->id] = $realm->org_name;
}
if (!empty($_POST)) {
$_POST["ts"] = date("c");
$i = new Institution($_POST);
$i->save();
}
pass_var("rids", $rids);
pass_var("title", "Add Institution");
pass_var("message", "Add Institution");
}
示例10: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$institution = Institution::findOrFail($id);
//get form data
$data = Input::only('title', 'body', 'topcolor', 'topfontcolor', 'currentdi', 'extracomments');
$data['logo'] = json_encode(Input::get('fileid'));
// validation rules
$rules = array('title' => 'required', 'logo' => 'required');
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$institution->update($data);
return Redirect::to_action('InstitutionsController@show', array($id));
}
示例11: search
public function search()
{
// Pick up parameters
$params = $_POST;
$keyword = $params['keyword'];
$city = $params['city'];
$institutions = $params['institutions'];
$accepted_max = $params['accepted_max'];
$accepted_min = $params['accepted_min'];
$extent_max = $params['extent_max'];
$extent_min = $params['extent_min'];
//check number values are valid
if (!is_numeric($accepted_max) || !is_numeric($accepted_min) || !is_numeric($extent_min) || !is_numeric($extent_max)) {
View::make('search.html', array('error' => 'Some search parameters were weird, try again!'));
}
//Convert percentages to decimal
$accepted_max = $accepted_max / 100;
$accepted_min = $accepted_min / 100;
//Find degrees that match the city and numeric parameters
$degrees = Degree::search($city, $accepted_max, $accepted_min, $extent_max, $extent_min);
$institutionCorrectDegrees = array();
//filter the results that contain correct institution
foreach ($degrees as $degree) {
foreach ($degree->institutions as $degreeInstitution) {
if (in_array($degreeInstitution->id, $institutions)) {
$institutionCorrectDegrees[] = $degree;
break;
}
}
}
//filter the results that match the keyword
$keywordMatchingDegrees = array();
if (strlen($keyword) > 0) {
$keywordMatchingDegrees = $this->filterByKeyword($institutionCorrectDegrees, $keyword);
} else {
$keywordMatchingDegrees = $institutionCorrectDegrees;
}
self::makeInstitutionsStrings($keywordMatchingDegrees);
$allInstitutions = Institution::all();
//add favorites
$favorites = FavoriteController::getUserFavorites();
//return view
if (empty($keywordMatchingDegrees)) {
$error = 'No results were found, sorry!';
View::make('search.html', array('institutions' => $allInstitutions, 'error' => $error, 'degrees' => $keywordMatchingDegrees));
}
View::make('search.html', array('institutions' => $allInstitutions, 'degrees' => $keywordMatchingDegrees, 'favorites' => $favorites));
}
示例12: postSelectPackage
public function postSelectPackage()
{
//verify the user input and create account
$validator = Validator::make(Input::all(), array('Package' => 'required'));
if ($validator->fails()) {
return Redirect::route('advanced_squeeb-get')->withInput()->with('global', 'Please select a package.');
} else {
$package = Input::get('Package');
View::share('package', $package);
//check for the world package
if ($package == 'pkg1') {
$countries = Country::all();
View::share('countries', $countries);
$obj = new BaseController();
$countryid = 0;
$countryname = $obj->getCountryName();
if ($countryname != 'NONE') {
$locationcountry = Country::where('name', '=', $countryname);
if ($locationcountry->count()) {
$countryid = $locationcountry->first()->id;
$colleges = Institution::where('country_id', '=', $countryid)->get();
View::share('colleges', $colleges);
}
}
View::share('countryid', $countryid);
return View::make('guest.advancedselectcollege');
} else {
if ($package == 'pkg2') {
$countries = Country::all();
View::share('countries', $countries);
$obj = new BaseController();
$countryid = 0;
$countryname = $obj->getCountryName();
if ($countryname != 'NONE') {
$locationcountry = Country::where('name', '=', $countryname);
if ($locationcountry->count()) {
$countryid = $locationcountry->first()->id;
}
}
View::share('countryid', $countryid);
return View::make('guest.advancedpostcountry')->with('msg', 'Country Squeeb Package');
}
}
if ($package == 'pkg3') {
return View::make('guest.advancedpost')->with('msg', 'World Squeeb Package');
}
}
}
示例13: delete
public function delete()
{
// we delete image first, but not the default one
if (is_file(WEBROOT . DS . $this->getImage()) && strpos($this->getImage(), 'site/assets') === false) {
unlink(WEBROOT . DS . $this->getImage());
}
if (is_file(WEBROOT . DS . $this->getBannerImage()) && strpos($this->getBannerImage(), 'site/assets') === false) {
unlink(WEBROOT . DS . $this->getBannerImage());
}
// we then delete all institutions under it
foreach (Institution::findAllByCountryId($this->getId()) as $i) {
$i->delete();
}
// we then delete all menu related to it
foreach (Menu::findByCountryId($this->getId()) as $menu) {
$menu->delete();
}
return parent::delete();
}
示例14: getSelectCountry
public function getSelectCountry($code)
{
$code = strtoupper($code);
$countryid = Country::where('code', '=', $code)->first()->id;
//get the country name
$countryname = Country::where('id', '=', $countryid)->first()->name;
//query the database for colleges in that country
$colleges = Institution::where('country_id', '=', $countryid)->orderBy('name', 'ASC')->get();
if ($colleges->count()) {
$countries = Country::where('id', '>', 0)->get();
View::share('countries', $countries);
View::share('colleges', $colleges);
View::share('countryid', $countryid);
View::share('countryname', $countryname);
return View::make('guest.selectcampus1');
} else {
$countries = Country::where('id', '>', 0)->get();
View::share('countries', $countries);
return Redirect::route('selectcampus-get')->withInput()->with('global', 'No Colleges were found in ' . $countryname . '!<br>Please <a href="http://www.squeeber.com/signup">add your college</a> and invite friends');
}
return Redirect::route('selectcampus-get')->withInput()->with('global', 'Sorry!! Campus details were not loaded, please retry.');
}
示例15: edituser_institution_validate
function edituser_institution_validate(Pieform $form, $values)
{
$user = new User();
if (!$user->find_by_id($values['id'])) {
return false;
}
global $USER;
$userinstitutions = $user->get('institutions');
if (isset($values['add']) && $USER->get('admin') && (empty($userinstitutions) || get_config('usersallowedmultipleinstitutions'))) {
// check if the institution is full
require_once get_config('docroot') . 'lib/institution.php';
$institution = new Institution($values['addinstitution']);
if ($institution->isFull()) {
$institution->send_admin_institution_is_full_message();
$form->set_error(null, get_string('institutionmaxusersexceeded', 'admin'));
}
}
}