当前位置: 首页>>代码示例>>PHP>>正文


PHP lang_string::out方法代码示例

本文整理汇总了PHP中lang_string::out方法的典型用法代码示例。如果您正苦于以下问题:PHP lang_string::out方法的具体用法?PHP lang_string::out怎么用?PHP lang_string::out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lang_string的用法示例。


在下文中一共展示了lang_string::out方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: subscription_details

 /**
  * Renders a table containing information about calendar subscriptions.
  *
  * @param int $courseid
  * @param array $subscriptions
  * @param string $importresults
  * @return string
  */
 public function subscription_details($courseid, $subscriptions, $importresults = '')
 {
     $table = new html_table();
     $table->head = array(get_string('colcalendar', 'calendar'), get_string('collastupdated', 'calendar'), get_string('eventkind', 'calendar'), get_string('colpoll', 'calendar'), get_string('colactions', 'calendar'));
     $table->align = array('left', 'left', 'left', 'center');
     $table->width = '100%';
     $table->data = array();
     if (empty($subscriptions)) {
         $cell = new html_table_cell(get_string('nocalendarsubscriptions', 'calendar'));
         $cell->colspan = 4;
         $table->data[] = new html_table_row(array($cell));
     }
     $strnever = new lang_string('never', 'calendar');
     foreach ($subscriptions as $sub) {
         $label = $sub->name;
         if (!empty($sub->url)) {
             $label = html_writer::link($sub->url, $label);
         }
         if (empty($sub->lastupdated)) {
             $lastupdated = $strnever->out();
         } else {
             $lastupdated = userdate($sub->lastupdated, get_string('strftimedatetimeshort', 'langconfig'));
         }
         $cell = new html_table_cell($this->subscription_action_form($sub, $courseid));
         $cell->colspan = 2;
         $type = $sub->eventtype . 'events';
         $table->data[] = new html_table_row(array(new html_table_cell($label), new html_table_cell($lastupdated), new html_table_cell(get_string($type, 'calendar')), $cell));
     }
     $out = $this->output->box_start('generalbox calendarsubs');
     $out .= $importresults;
     $out .= html_writer::table($table);
     $out .= $this->output->box_end();
     return $out;
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:42,代码来源:renderer.php

示例2: out

 /**
  * Returns the string
  *
  * @param string $lang The langauge to use when processing the string
  * @return string
  */
 public function out($lang = null)
 {
     if ($lang !== null && $lang != $this->lang && ($this->lang == null && $lang != current_language())) {
         if ($this->forcedstring) {
             debugging('lang_string objects that have been used cannot be printed in another language. (' . $this->lang . ' used)', DEBUG_DEVELOPER);
             return $this->get_string();
         }
         $translatedstring = new lang_string($this->identifier, $this->component, $this->a, $lang);
         return $translatedstring->out();
     }
     return $this->get_string();
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:18,代码来源:moodlelib.php

示例3: validation

 public function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     // Conditions: Don't let them set dates which make no sense
     if (array_key_exists('availablefrom', $data) && $data['availablefrom'] && $data['availableuntil'] && $data['availablefrom'] >= $data['availableuntil']) {
         $errors['availablefrom'] = get_string('badavailabledates', 'condition');
     }
     // Conditions: Verify that the grade conditions are numbers, and make sense.
     if (array_key_exists('conditiongradegroup', $data)) {
         foreach ($data['conditiongradegroup'] as $i => $gradedata) {
             if ($gradedata['conditiongrademin'] !== '' && !is_numeric(unformat_float($gradedata['conditiongrademin']))) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
                 continue;
             }
             if ($gradedata['conditiongrademax'] !== '' && !is_numeric(unformat_float($gradedata['conditiongrademax']))) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
                 continue;
             }
             if ($gradedata['conditiongrademin'] !== '' && $gradedata['conditiongrademax'] !== '' && unformat_float($gradedata['conditiongrademax']) <= unformat_float($gradedata['conditiongrademin'])) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('badgradelimits', 'condition');
                 continue;
             }
             if ($gradedata['conditiongrademin'] === '' && $gradedata['conditiongrademax'] === '' && $gradedata['conditiongradeitemid']) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradeitembutnolimits', 'condition');
                 continue;
             }
             if (($gradedata['conditiongrademin'] !== '' || $gradedata['conditiongrademax'] !== '') && !$gradedata['conditiongradeitemid']) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradelimitsbutnoitem', 'condition');
                 continue;
             }
         }
     }
     // Conditions: Verify that the user profile field has not been declared more than once
     if (array_key_exists('conditionfieldgroup', $data)) {
         // Array to store the existing fields
         $arrcurrentfields = array();
         // Error message displayed if any condition is declared more than once. We use lang string because
         // this way we don't actually generate the string unless there is an error.
         $stralreadydeclaredwarning = new lang_string('fielddeclaredmultipletimes', 'condition');
         foreach ($data['conditionfieldgroup'] as $i => $fielddata) {
             if ($fielddata['conditionfield'] == 0) {
                 // Don't need to bother if none is selected
                 continue;
             }
             if (in_array($fielddata['conditionfield'], $arrcurrentfields)) {
                 $errors["conditionfieldgroup[{$i}]"] = $stralreadydeclaredwarning->out();
             }
             // Add the field to the array
             $arrcurrentfields[] = $fielddata['conditionfield'];
         }
     }
     return $errors;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:53,代码来源:editsection_form.php

示例4: validation

 function validation($data, $files)
 {
     global $COURSE, $DB;
     $errors = parent::validation($data, $files);
     $mform =& $this->_form;
     $errors = array();
     if ($mform->elementExists('name')) {
         $name = trim($data['name']);
         if ($name == '') {
             $errors['name'] = get_string('required');
         }
     }
     $grade_item = grade_item::fetch(array('itemtype' => 'mod', 'itemmodule' => $data['modulename'], 'iteminstance' => $data['instance'], 'itemnumber' => 0, 'courseid' => $COURSE->id));
     if ($data['coursemodule']) {
         $cm = $DB->get_record('course_modules', array('id' => $data['coursemodule']));
     } else {
         $cm = null;
     }
     if ($mform->elementExists('cmidnumber')) {
         // verify the idnumber
         if (!grade_verify_idnumber($data['cmidnumber'], $COURSE->id, $grade_item, $cm)) {
             $errors['cmidnumber'] = get_string('idnumbertaken');
         }
     }
     // Completion: Don't let them choose automatic completion without turning
     // on some conditions
     if (array_key_exists('completion', $data) && $data['completion'] == COMPLETION_TRACKING_AUTOMATIC) {
         if (empty($data['completionview']) && empty($data['completionusegrade']) && !$this->completion_rule_enabled($data)) {
             $errors['completion'] = get_string('badautocompletion', 'completion');
         }
     }
     // Conditions: Don't let them set dates which make no sense
     if (array_key_exists('availablefrom', $data) && $data['availablefrom'] && $data['availableuntil'] && $data['availablefrom'] >= $data['availableuntil']) {
         $errors['availablefrom'] = get_string('badavailabledates', 'condition');
     }
     // Conditions: Verify that the grade conditions are numbers, and make sense.
     if (array_key_exists('conditiongradegroup', $data)) {
         foreach ($data['conditiongradegroup'] as $i => $gradedata) {
             if ($gradedata['conditiongrademin'] !== '' && !is_numeric(unformat_float($gradedata['conditiongrademin']))) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
                 continue;
             }
             if ($gradedata['conditiongrademax'] !== '' && !is_numeric(unformat_float($gradedata['conditiongrademax']))) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
                 continue;
             }
             if ($gradedata['conditiongrademin'] !== '' && $gradedata['conditiongrademax'] !== '' && unformat_float($gradedata['conditiongrademax']) <= unformat_float($gradedata['conditiongrademin'])) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('badgradelimits', 'condition');
                 continue;
             }
             if ($gradedata['conditiongrademin'] === '' && $gradedata['conditiongrademax'] === '' && $gradedata['conditiongradeitemid']) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradeitembutnolimits', 'condition');
                 continue;
             }
             if (($gradedata['conditiongrademin'] !== '' || $gradedata['conditiongrademax'] !== '') && !$gradedata['conditiongradeitemid']) {
                 $errors["conditiongradegroup[{$i}]"] = get_string('gradelimitsbutnoitem', 'condition');
                 continue;
             }
         }
     }
     // Conditions: Verify that the user profile field has not been declared more than once
     if (array_key_exists('conditionfieldgroup', $data)) {
         // Array to store the existing fields
         $arrcurrentfields = array();
         // Error message displayed if any condition is declared more than once. We use lang string because
         // this way we don't actually generate the string unless there is an error.
         $stralreadydeclaredwarning = new lang_string('fielddeclaredmultipletimes', 'condition');
         foreach ($data['conditionfieldgroup'] as $i => $fielddata) {
             if ($fielddata['conditionfield'] == 0) {
                 // Don't need to bother if none is selected
                 continue;
             }
             if (in_array($fielddata['conditionfield'], $arrcurrentfields)) {
                 $errors["conditionfieldgroup[{$i}]"] = $stralreadydeclaredwarning->out();
             }
             // Add the field to the array
             $arrcurrentfields[] = $fielddata['conditionfield'];
         }
     }
     return $errors;
 }
开发者ID:Burick,项目名称:moodle,代码行数:81,代码来源:moodleform_mod.php

示例5: validation

 public function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     // Conditions: Don't let them set dates which make no sense
     if (array_key_exists('availablefrom', $data) && $data['availablefrom'] && $data['availableuntil'] && $data['availablefrom'] > $data['availableuntil']) {
         $errors['availablefrom'] = get_string('badavailabledates', 'condition');
     }
     // Conditions: Verify that the user profile field has not been declared more than once
     if (array_key_exists('conditionfieldgroup', $data)) {
         // Array to store the existing fields
         $arrcurrentfields = array();
         // Error message displayed if any condition is declared more than once. We use lang string because
         // this way we don't actually generate the string unless there is an error.
         $stralreadydeclaredwarning = new lang_string('fielddeclaredmultipletimes', 'condition');
         foreach ($data['conditionfieldgroup'] as $i => $fielddata) {
             if ($fielddata['conditionfield'] == 0) {
                 // Don't need to bother if none is selected
                 continue;
             }
             if (in_array($fielddata['conditionfield'], $arrcurrentfields)) {
                 $errors["conditionfieldgroup[{$i}]"] = $stralreadydeclaredwarning->out();
             }
             // Add the field to the array
             $arrcurrentfields[] = $fielddata['conditionfield'];
         }
     }
     return $errors;
 }
开发者ID:nigeli,项目名称:moodle,代码行数:28,代码来源:editsection_form.php


注:本文中的lang_string::out方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。