本文整理汇总了PHP中Subject::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::update方法的具体用法?PHP Subject::update怎么用?PHP Subject::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subject
的用法示例。
在下文中一共展示了Subject::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write_aspect
public function write_aspect()
{
$new_aspect = new Aspect();
$new_aspect->aspect_type = '';
$new_aspect->aspect_data = $this->result;
$new_aspect->aspect_source = 'Wikipedia API results';
$new_aspect->markdown = 0;
$new_aspect->is_hidden = 1;
$new_aspect->save();
$new_subject = new Subject();
$new_subject->load($this->subject_id);
$new_subject->add_aspect($new_aspect);
$new_subject->update();
}
示例2: subject
public static function subject($type, $data)
{
require_once 'subject.class.php';
$class = new Subject();
$status = false;
$class->setData($data);
switch ($type) {
case 'add':
$status = $class->add();
break;
case 'update':
$status = $class->update();
break;
case 'delete':
$status = $class->delete();
break;
case 'getsingle':
$status = $class->getsingle();
break;
case 'getpage':
$status = $class->getpage();
break;
case 'search':
$status = $class->search();
break;
default:
break;
}
if ($status) {
wp_send_json_success($status);
} else {
wp_send_json_error($class->error);
}
}
示例3: doEdit
function doEdit()
{
if (isset($_POST['savecourse'])) {
if ($_POST['subjcode'] == "" or $_POST['subjdesc'] == "" or $_POST['unit'] == "") {
message("All field is required!", "error");
redirect('index.php');
} else {
$subj = new Subject();
$Subjectid = $_GET['id'];
$subjcode = $_POST['subjcode'];
$subjdesc = $_POST['subjdesc'];
$unit = $_POST['unit'];
$pre = $_POST['pre'];
$course = $_POST['course'];
$ay = $_POST['ay'];
$Semester = $_POST['Semester'];
$subj->SUBJ_ID = $Subjectid;
$subj->SUBJ_CODE = $subjcode;
$subj->SUBJ_DESCRIPTION = $subjdesc;
$subj->UNIT = $unit;
$subj->PRE_REQUISITE = $pre;
$subj->COURSE_ID = $course;
$subj->AY = $ay;
$subj->SEMESTER = $Semester;
$subj->update($Subjectid);
message($subjcode . " has updated successfully!", "info");
redirect('index.php');
}
}
}
示例4: Subject
}
}
break;
case "new_subject":
$new_subject = new Subject();
$new_subject->subject_type_id = $_POST['subject_type_id'];
$new_subject->name = $_POST['name'];
$new_subject->save();
echo "Saved.";
break;
case "edit_subject":
$current_subject = new Subject();
$current_subject->load($_POST['subject_id']);
$current_subject->name = $_POST['name'];
$current_subject->subject_type_id = $_POST['subject_type_id'];
$current_subject->update();
echo "saved.";
break;
case "delete_subject":
$current_subject = new Subject();
$current_subject->load($_POST['subject_id']);
$current_subject->delete();
echo "deleted";
break;
default:
new LogEntry(__FILE__ . " was hit with an invalid action, from IP: " . $_SERVER['REMOTE_ADDR']);
echo 'There was an error. It has been logged.';
}
} else {
new LogEntry(__FILE__ . " was hit with no action, from IP: " . $_SERVER['REMOTE_ADDR']);
echo 'There was an error. It has been logged.';
示例5:
<button type="reset">RESET</button>
<button type="submit"
name="stage"
value="2">submit</button>
</fieldset>
</form>
</div>';
break;
case "2":
$subject->setCode($_POST["code"]);
$subject->setName($_POST["name"]);
$subject->setDescription($_POST["description"]);
$subject->setStartYear($_POST["startYear"]);
$subject->setStopYear($_POST["stopYear"]);
if ($subject->validate()) {
if ($subject->update()) {
$pageBody .= '
<table>
<tbody>
<tr>
<th>code</th>
<td>' . $subject->getCode() . '</td>
</tr>
<tr>
<th>name</th>
<td>' . $subject->getName() . '</td>
</tr>
<tr>
<th>description</th>
<td>' . $subject->getDescription() . '</td>
</tr>
示例6: showSubject
function showSubject()
{
global $connector;
$subject = new Subject();
$subject->setConnector($connector);
if (isset($_POST['operation'])) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'saveChanges':
$subject->storeFormValues($_POST);
$error_msg = $subject->insert();
if ($error_msg) {
$result['edit'] = $subject;
}
break;
case 'delete':
$error_msg = $subject->delete($params);
break;
case 'edit':
$result['edit'] = $subject->getById($params);
break;
case 'editChanges':
$subject->storeFormValues($_POST);
$error_msg = $subject->update();
break;
default:
$error_msg = "Operazione non valida";
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit') {
$result["statusMessage"] = "Operazione completata!";
}
}
if (isset($_POST['search'])) {
$result["subjects"] = $subject->search($_POST['search']);
} else {
$result["subjects"] = $subject->getList();
}
$page = "subject.php";
include_once BASE_PATH . "template.php";
}
示例7: add_new_people
public function add_new_people()
{
$raw_array = unserialize($this->aspect_data);
$entry_array = $raw_array['feed']['entry'];
foreach ($entry_array as $entry) {
// first, check to see if the entry already exists by looking for a google Contact Id.
if (!find_aspect_from_data($entry['id']['$t']) && !empty($entry['title']['$t'])) {
// no entry exists, create a new subject and populate.
$person = new Subject();
$person->subject_type_id = '14';
// hardcoded for the subject type at the moment. This should be replaced with a factory.
$person->name = $entry['title']['$t'];
$person->save();
// make sure we save it.
// now let's add aspects.
if (isset($entry['id']['$t'])) {
$person->quick_add('Google Contact ID', $entry['id']['$t']);
}
// ////////
if (isset($entry['gd$etag'])) {
$person->quick_add('Google Contact Etag', $entry['gd$etag']);
}
// ///////
if (isset($entry['gd$name']['gd$givenName']['$t'])) {
$person->quick_add('First Name', $entry['gd$name']['gd$givenName']['$t']);
}
// ///////
if (isset($entry['gd$name']['gd$familyName']['$t'])) {
$person->quick_add('Last Name', $entry['gd$name']['gd$familyName']['$t']);
}
// ///////
if (isset($entry['gContact$gender']['value'])) {
$person->quick_add('Gender', $entry['gContact$gender']['value']);
}
// ///////
if (isset($entry['gd$organization'])) {
// loop through.
foreach ($entry['gd$organization'] as $organizatiom) {
// this requires more thought.
// $person->quick_add('Gender', $entry['gContact$gender']['value']);
}
}
// ///////
if (isset($entry['gd$email'])) {
foreach ($entry['gd$email'] as $email) {
$person->quick_add('Email Address', $email['address']);
}
}
// ///////
if (isset($entry['gd$phoneNumber'])) {
foreach ($entry['gd$phoneNumber'] as $phone) {
$person->quick_add('Telephone Number', $phone['uri']);
}
}
if (isset($entry['gd$structuredPostalAddress'])) {
if (isset($entry['gd$structuredPostalAddress'][0]['gd$street']['$t'])) {
$person->quick_add('Street Address', $entry['gd$structuredPostalAddress'][0]['gd$street']['$t']);
}
if (isset($entry['gd$structuredPostalAddress'][0]['gd$city']['$t'])) {
$person->quick_add('City', $entry['gd$structuredPostalAddress'][0]['gd$city']['$t']);
}
if (isset($entry['gd$structuredPostalAddress'][0]['gd$region']['$t'])) {
$person->quick_add('State', $entry['gd$structuredPostalAddress'][0]['gd$region']['$t']);
}
if (isset($entry['gd$structuredPostalAddress'][0]['gd$postcode']['$t'])) {
$person->quick_add('Zip Code', $entry['gd$structuredPostalAddress'][0]['gd$postcode']['$t']);
}
if (isset($entry['gd$structuredPostalAddress'][0]['gd$formattedAddress']['$t'])) {
$person->quick_add('Formatted Address', $entry['gd$structuredPostalAddress'][0]['gd$formattedAddress']['$t']);
}
}
if (isset($entry['gContact$website'])) {
foreach ($entry['gContact$website'] as $link) {
$link_html = '<a href="' . $link['href'] . '">' . $link['label'] . '</a>';
$person->quick_add('Hyperlink', $link_html);
}
}
$person->update();
}
// end duplicate check.
}
// end foreach
}