本文整理汇总了PHP中Institution::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Institution::save方法的具体用法?PHP Institution::save怎么用?PHP Institution::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Institution
的用法示例。
在下文中一共展示了Institution::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public static function store()
{
if (self::get_user_admin() == null) {
Redirect::to('/home');
}
$params = $_POST;
$institution = new Institution(array('name' => $params['name'], 'picture' => $params['picture']));
$errors = $institution->errors();
if (count($errors) == 0) {
$institution->save();
Redirect::to('/institutions', array('message' => 'New institution added!'));
} else {
View::make('admin/institution.html', array('errors' => $errors, 'attributes' => $params));
}
}
示例2: 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");
}
示例3: actionAddInstitution
public function actionAddInstitution()
{
$institution = new Institution();
$address = new Address();
$errors = array();
if (!empty($_POST)) {
$institution->attributes = $_POST['Institution'];
if (!$institution->validate()) {
$errors = $institution->getErrors();
}
$address->attributes = $_POST['Address'];
if ($address->validate()) {
$errors = array_merge($errors, $address->getErrors());
}
if (empty($errors)) {
if (!$institution->save()) {
throw new Exception("Unable to save institution: " . print_r($institution->getErrors(), true));
}
if (!$address->save()) {
throw new Exception("Unable to save institution address: " . print_r($address->getErrors(), true));
}
$institution->addAddress($address);
if (!$institution->contact->save()) {
throw new Exception("Institution contact could not be saved: " . print_r($institution->contact->getErrors(), true));
}
Audit::add('admin-Institution', 'add', $institution->id);
$this->redirect(array('/admin/editInstitution?institution_id=' . $institution->id));
}
}
$this->render('/admin/addinstitution', array('institution' => $institution, 'address' => $address, 'errors' => @$errors));
}
示例4: Message
// proceed for $title
$object->setTitle($title);
// proceed for $country_id
if (!empty($country_id)) {
$object->setCountryId($country_id);
}
// proceed for $image
$object->setImage($image);
// proceed for $content
$object->setContent($content);
// proceed for $url
$object->setUrl($url);
// proceed for $weight
$object->setWeight($weight);
if ($error_flag == false) {
if ($object->save()) {
Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
HTML::forwardBackToReferer();
} else {
Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
}
}
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Institution', 'zh' => 'Create 教育院校'))));
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('institution/backend/institution_create', array('object' => $object));
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
exit;
示例5: ServerValidate
$opInst->name = $_POST["name"];
$opInst->type = $_POST["type"];
$opInst->city = $_POST["city"];
$opInst->state = $_POST["state"];
$opInst->zipcode = $_POST["zipcode"];
$opInst->country = $_POST["country"];
// DO SERVER SIDE VALIDATION
$errors = 0;
$validationOutput = ServerValidate($vItems, "return");
if ($validationOutput) {
$errors++;
$Message = "<fieldset><legend>Validation Errors</legend>" . "<span style='color:red;'>Please fix the following errors:</span><br/>" . $validationOutput . "</fieldset>";
}
if ($errors == 0) {
// save the current inst
if (!$opInst->save()) {
$Message = "Error: Could not save: " . $opInst->Message;
} else {
$Message = "<strong>Saved institution information</strong>";
if (!$PK) {
// added a new institution
echo "Created new institution: {$opInst->name}<br/>" . "<a href='{$_SERVER['PHP_SELF']}?pk={$opInst->pk}'>Edit this institution</a> " . "or <a href='admin_insts.php'>Go to Institutions page</a>";
include $ACCOUNTS_PATH . 'include/footer.php';
exit;
}
}
} else {
$Message = "<div class='error'>Please fix the following errors:\n<blockquote>\n{$Message}</blockquote>\n</div>\n";
}
}
//echo $opUser, "<br/>"; // for testing
示例6: setVoteRep
public function setVoteRep($set = true)
{
// TODO - make sure this works
if (!$this->institution_pk) {
$this->Message = "Invalid institution_pk ({$this->institution_pk})";
return false;
}
// first get the Institution for this user
$Inst = new Institution($this->institution_pk);
if ($Inst->pk <= 0) {
$this->Message = "Invalid institution object ({$this->institution_pk})";
return false;
}
// clear the rep (set to the inst rep by default)
if (!$set) {
$Inst->repvote_pk = $Inst->rep_pk;
$this->isVoteRep = false;
return $Inst->save();
}
// then set this person as the rep
$Inst->repvote_pk = $this->pk;
// save the new vote rep
if ($Inst->save()) {
$this->isVoteRep = true;
return true;
}
return false;
}
示例7: ferries
<h2 class="dax_normal">About our Sydney centre</h2> <h3 class="dax_normal">See our centre in action</h3> <p>Watch this video to find out more about our Navitas English centre in Sydney, and to see it in action.</p> <h3 class="dax_normal">What can I do in Sydney?</h3> <p>The majestic Sydney Opera House is only 15 minutes\' walk away and holds many world-class musical and theatre performances all year round, as well as more affordable cultural and comedic events to suit all budgets. The Harbour Bridge and Museum of Contemporary Art are only 10 minutes’ walk away; if you like adventure you can\'t go past a Bridge Climb at dusk and for culture the MCA has many great free exhibitions to dazzle your senses.</p> <p>A short walk will also bring to you Sydney\'s oldest established area, The Rocks, which delivers amazing pubs, cobbled streets and great markets and shops. And a walk in the opposite direction will bring to you Pitt Street Mall, the home of shopping in Sydney.</p> <p>And to top it off, Sydney aims to please when dining out. Whether it\'s fine dining restaurant overlooking the harbour for a special occasion, or a bustling food court for dumplings in Chinatown, there is something for every taste and budget.</p>
<h2 class="dax_normal">Learn about Sydney</h2> <h3 class="dax_normal">Population</h3> <p>Sydney: 4.5 million<br> City: 177,000</p> <h3 class="dax_normal">Climate</h3> <p>Summer: 18.3 - 25.6°C<br> Winter: 8.7 - 17.0°C</p> <h3 class="dax_normal">Public transport</h3> <p>Navitas English Sydney is located directly above Wynyard Green train station and directly across from Wynyard bus station in central Sydney. The Circular Quay ferries (right near the Opera House) are also just a 10 minute walk away.</p> <p>For more information on transport in Sydney, see 131500.com.au (NSW Transport Info). Google Maps now also features public transport for Sydney.</p> <ul class="block_list single"> <li><a target="_blank" href="http://www.131500.com.au/">NSW Transport Info</a></li> </ul> <h3 class="dax_normal">More information</h3> <p>Use these links to find more information about Sydney, tourist attractions, local events, and more.</p> <ul class="block_list single"> <li><a target="_blank" href="http://en.wikipedia.org/wiki/Sydney">Sydney (Wikipedia)</a></li> <li><a target="_blank" href="http://www.sydney.com/">Sydney.com</a></li> <li><a target="_blank" href="http://www.australia.com/explore/cities/sydney.aspx">Sydney (Tourism Australia)</a></li> <li><a href="http://navitasenglish.com/accommodation-sydney.html">Independent Accommodation Options</a></li> </ul>
');
$institution->setUrl('http://navitasenglish.com/');
$institution->setWeight(0);
$institution->save();
$institution = new Institution();
$institution->setTitle('SIIT - Sydney Institute of Interpreting & Translating');
$institution->setCountryId(1);
$institution->setImage('modules/site/assets/images/i-siit.jpg');
$institution->setContent('
<h2>Brief Introduction to SIIT </h2>
<p>Sydney Institute of Interpreting and Translating (SIIT) is a registered training organisation for training interpreters and translators.</p>
<p>The programs offered at SIIT have been specifically designed to cater for the needs of students who are interested in careers as interpreters and translators. With dedicated trainers and caring administrative staff, SIIT provides students with a nurturing and conducive atmosphere for their studies and career development.<br>
</p>
<p><strong>Mission Statement: </strong></p>
<ol>
<li>SIIT ensures that students are trained in the most effective and professional manner in their chosen career paths as professional interpreters and translators;</li>
<li>SIIT provides appropriate training and resources in the areas of interpreting and translating;</li>
<li>SIIT assists students in gaining employment and achieving their career goals in the areas of interpreting and translating;</li>
<li>SIIT helps students further their academic studies in the areas of interpreting and translating.</li>
</ol>
<p><strong>Location :Sydney</strong></p>
<p>Located on Level 5, 841 George Street Sydney 2000.</p>
<p><strong>Location :Brisbane</strong></p>
<p>Located on Level 1, 344 Queen St, Brisbane, QLD 4000.</p>
');
$institution->setUrl('http://www.siit.nsw.edu.au');
$institution->setWeight(1);
$institution->save();
}