本文整理匯總了PHP中Subject::add_aspect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subject::add_aspect方法的具體用法?PHP Subject::add_aspect怎麽用?PHP Subject::add_aspect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Subject
的用法示例。
在下文中一共展示了Subject::add_aspect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Subject
}
$current_subject = new Subject();
$current_subject->load((int) $_POST['subject_id']);
$new_aspect = new Aspect();
$new_aspect->aspect_type = (int) $_POST['aspect_type'];
if (isset($file_location)) {
$new_aspect->aspect_data = $file_location;
} else {
$new_aspect->aspect_data = $_POST['aspect_data'];
}
$new_aspect->aspect_binary = NULL;
$new_aspect->predicted_accuracty = NULL;
$new_aspect->aspect_notes = $_POST['aspect_notes'];
$new_aspect->aspect_source = $_POST['aspect_source'];
$new_aspect->save();
$current_subject->add_aspect($new_aspect);
$output .= 'Added ' . $new_aspect->return_aspect_type_name() . ' to ' . $current_subject->name . '.';
echo $output;
break;
case "edit_aspect":
// do something.
$new_aspect = new Aspect();
$new_aspect->load((int) $_POST['aspect_id']);
$new_aspect->aspect_type = (int) $_POST['aspect_type'];
$new_aspect->aspect_data = $_POST['aspect_data'];
$new_aspect->aspect_binary = NULL;
$new_aspect->predicted_accuracty = NULL;
$new_aspect->aspect_notes = $_POST['aspect_notes'];
$new_aspect->aspect_source = $_POST['aspect_source'];
$new_aspect->update();
$output = 'Updated ' . $new_aspect->return_aspect_type_name() . '.';
示例2: 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();
}