本文整理匯總了PHP中type::getTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::getTitle方法的具體用法?PHP type::getTitle怎麽用?PHP type::getTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::getTitle方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createMilestone
/**
* @param type $issueMilestone
*/
public function createMilestone($issueMilestone)
{
$milestoneData = array('title' => $issueMilestone->getTitle(), 'description' => $issueMilestone->getDescription(), 'due_date' => $issueMilestone->getDueOn()->format('c'));
$this->authenticate();
$milestone = $this->client->api('milestones')->create($this->issueIntegrator->getProjectName(), $milestoneData);
return $this->mapToEntity($milestone);
}
示例2: save_updated_submission_data
/**
* Save updated submission data from Turnitin to the database
*
* @global type $DB
* @param type $tiisubmissiondata
* @param type $bulk
* @param type $save - save in db regardless of changes
* @return type
*/
public function save_updated_submission_data($tiisubmissiondata, $bulk = false, $save = false)
{
global $DB, $CFG;
static $part;
static $tiiassignid;
if ($tiiassignid != $tiisubmissiondata->getAssignmentId() || empty($part)) {
$part = $DB->get_record("turnitintooltwo_parts", array("tiiassignid" => $tiisubmissiondata->getAssignmentId()));
}
$turnitintooltwoassignment = new turnitintooltwo_assignment($part->turnitintooltwoid);
$sub = new stdClass();
$sub->submission_title = $tiisubmissiondata->getTitle();
$sub->submission_part = $part->id;
$sub->submission_objectid = $tiisubmissiondata->getSubmissionId();
$sub->turnitintooltwoid = $turnitintooltwoassignment->turnitintooltwo->id;
$sub->submission_score = is_numeric($tiisubmissiondata->getOverallSimilarity()) ? $tiisubmissiondata->getOverallSimilarity() : null;
$sub->submission_transmatch = 0;
if ($turnitintooltwoassignment->turnitintooltwo->transmatch == 1 && is_int($tiisubmissiondata->getTranslatedOverallSimilarity())) {
if ($tiisubmissiondata->getTranslatedOverallSimilarity() > $tiisubmissiondata->getOverallSimilarity()) {
$sub->submission_score = $tiisubmissiondata->getTranslatedOverallSimilarity();
$sub->submission_transmatch = 1;
}
}
$sub->submission_grade = $tiisubmissiondata->getGrade() == '' ? null : $tiisubmissiondata->getGrade();
$sub->submission_gmimaged = $tiisubmissiondata->getFeedbackExists();
$sub->submission_unanon = $tiisubmissiondata->getAnonymous() == 1 ? 0 : 1;
$sub->submission_orcapable = $tiisubmissiondata->getOriginalityReportCapable() == 1 ? 1 : 0;
$sub->submission_acceptnothing = $tiisubmissiondata->getAcceptNothingSubmission() == 1 ? 1 : 0;
$sub->submission_unanonreason = $sub->submission_unanon == 1 ? urldecode($tiisubmissiondata->getAnonymousRevealReason()) : null;
$sub->submission_modified = strtotime($tiisubmissiondata->getDate());
$sub->translated_overall_similarity = $tiisubmissiondata->getTranslatedOverallSimilarity();
$sub->submission_attempts = $tiisubmissiondata->getAuthorLastViewedFeedback() > 0 ? strtotime($tiisubmissiondata->getAuthorLastViewedFeedback()) : 0;
// If save not passed in then only update if certain items have changed to save on database load.
if ($this->submission_grade != $sub->submission_grade || $this->submission_score != $sub->submission_score || $this->submission_modified != $sub->submission_modified || $this->submission_attempts != $sub->submission_attempts || $this->submission_unanon != $sub->submission_unanon || $this->submission_part != $sub->submission_part) {
$save = true;
}
$cm = get_coursemodule_from_instance("turnitintooltwo", $turnitintooltwoassignment->turnitintooltwo->id, $turnitintooltwoassignment->turnitintooltwo->course);
if ($save) {
// If the user is not a moodle user then get their name from Tii - only do this on initial save.
$sub->userid = turnitintooltwo_user::get_moodle_user_id($tiisubmissiondata->getAuthorUserId());
// If we have no user ID get it from the Moodle database by using their Turnitin e-mail address.
if ($sub->userid == 0) {
$tmpuser = new turnitintooltwo_user(0);
$tmpuser->tii_user_id = $tiisubmissiondata->getAuthorUserId();
$tiiuser = $tmpuser->set_user_values_from_tii();
if ($userrecord = $DB->get_record('user', array('email' => $tiiuser["email"]))) {
$sub->userid = $userrecord->id;
}
}
// Check if the user is enrolled.
if ($sub->userid != 0) {
$context = context_module::instance($cm->id);
if (!is_enrolled($context, $sub->userid)) {
// Enroll the user as a student.
$enrol = enrol_get_plugin('manual');
$instance = $DB->get_record("enrol", array('courseid' => $cm->course, 'enrol' => 'manual'));
$enrol->enrol_user($instance, $sub->userid, 5);
}
}
if ($sub->userid == 0 && empty($this->id)) {
if ($tiisubmissiondata->getAuthorUserId() > 0) {
$sub->submission_nmuserid = $tiisubmissiondata->getAuthorUserId();
$tmpuser = new turnitintooltwo_user(0);
$tmpuser->tii_user_id = $tiisubmissiondata->getAuthorUserId();
$tiiuser = $tmpuser->set_user_values_from_tii();
$sub->submission_nmfirstname = $tiiuser["firstname"];
$sub->submission_nmlastname = $tiiuser["lastname"];
} else {
$sub->submission_nmuserid = "nm-" . $tiisubmissiondata->getAuthorUserId();
$sub->submission_nmfirstname = '';
$sub->submission_nmlastname = get_string('nonmoodleuser', 'turnitintooltwo');
}
}
if (!empty($this->id)) {
$sub->id = $this->id;
$DB->update_record("turnitintooltwo_submissions", $sub, $bulk);
} else {
$sub->id = $DB->insert_record("turnitintooltwo_submissions", $sub, true, $bulk);
}
// Update gradebook.
@(include_once $CFG->libdir . "/gradelib.php");
if ($sub->userid > 0 && $sub->submission_unanon) {
$user = new turnitintooltwo_user($sub->userid, "Learner");
$grades = new stdClass();
// Only add to gradebook if author has been unanonymised or assignment doesn't have anonymous marking
if ($submissions = $DB->get_records('turnitintooltwo_submissions', array('turnitintooltwoid' => $turnitintooltwoassignment->turnitintooltwo->id, 'userid' => $user->id, 'submission_unanon' => 1))) {
$overallgrade = $turnitintooltwoassignment->get_overall_grade($submissions);
if ($turnitintooltwoassignment->turnitintooltwo->grade < 0) {
// Using a scale.
$grades->rawgrade = $overallgrade == '--' ? null : $overallgrade;
} else {
$grades->rawgrade = $overallgrade == '--' ? null : number_format($overallgrade, 2);
//.........這裏部分代碼省略.........
示例3: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
$rules = $this->_parseRules($field->getValidationData(), $value);
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
if (!$this->validate($rule, $args['args'])) {
$errors[] = $field->getTitle() . ' ' . $args['message'];
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例4: getNamespaceFromObject
/**
* @param type $object has to be instance of WikiPage, OutputPage or Title
*/
protected function getNamespaceFromObject($object)
{
if ($object instanceof WikiPage || $object instanceof OutputPage) {
return $object->getTitle()->getNamespace();
} elseif ($object instanceof Title) {
return $object->getNamespace();
} else {
throw new \Exception('Invalid Object passed to' . __METHOD__);
}
}
示例5: createLabel
/**
* @param type $issueLabel
*/
public function createLabel($issueLabel)
{
$this->authenticate();
$label = $this->client->api('issue')->labels()->create($this->issueIntegrator->getOwnerName(), $this->issueIntegrator->getRepoName(), array('name' => $issueLabel->getTitle(), 'color' => $issueLabel->getHexColor()));
return $this->mapToEntity($label);
}
示例6: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
$rules = $this->_parseRules($field->getValidationData(), $value);
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
if (!$this->validate($rule, $args['args'])) {
/**
* Allow turn off field name.
*
* Allow turn off field name from error message.
*
* @since x.x.x
*
* @param boolean $var show field title in message, * default true.
*/
if (apply_filters('toolset_common_validation_add_field_name_to_error', true)) {
$errors[] = $field->getTitle() . ' ' . $args['message'];
} else {
$errors[] = $args['message'];
}
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例7: createLabel
/**
* @param type $issueLabel
*/
public function createLabel($issueLabel)
{
$this->authenticate();
$label = $this->client->api('projects')->addLabel($this->issueIntegrator->getProjectName(), array('name' => $issueLabel->getTitle(), 'color' => '#' . $issueLabel->getHexColor()));
return $this->mapToEntity($label);
}