本文整理汇总了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();
}