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


PHP single_button类代码示例

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


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

示例1: definition

 /**
  * Form definition
  *
  * @uses $CFG
  */
 public function definition()
 {
     // if there are no rows in the table, return.
     // (won't be rows if both olduser and newuser are NULL in session stdClass)
     if (empty($this->urt->data)) {
         return '';
     }
     $mform =& $this->_form;
     // header
     $mform->addElement('header', 'reviewusers', get_string('userreviewtable_legend', 'tool_mergeusers'));
     // table content
     $mform->addElement('static', 'reviewuserslist', '', html_writer::table($this->urt));
     // buttons
     // set up url here so the same url can be used more than once
     $mergeurl = new moodle_url('/admin/tool/mergeusers/index.php');
     $buttonarray = array();
     if ($this->review_step) {
         $mergeurl->param('option', 'mergeusers');
         $mergeusersbutton = new single_button($mergeurl, get_string('mergeusers', 'tool_mergeusers'));
         $mergeusersbutton->add_confirm_action(get_string('mergeusers_confirm', 'tool_mergeusers'));
         $buttonarray[0][] = $this->output->render($mergeusersbutton);
     } else {
         if (count($this->urt->data) === 2) {
             $mergeurl->param('option', 'continueselection');
             $mergeusersbutton = new single_button($mergeurl, get_string('saveselection_submit', 'tool_mergeusers'));
             $buttonarray[0][] = $this->output->render($mergeusersbutton);
         }
     }
     $mergeurl->param('option', 'clearselection');
     $mergeusersbutton = new single_button($mergeurl, get_string('clear_selection', 'tool_mergeusers'));
     $buttonarray[0][] = $this->output->render($mergeusersbutton);
     if ($this->review_step) {
         $mergeurl->param('option', 'searchusers');
         $mergeusersbutton = new single_button($mergeurl, get_string('cancel'));
         $buttonarray[0][] = $this->output->render($mergeusersbutton);
     }
     $htmltable = new html_table();
     $htmltable->attributes['class'] = 'clearfix';
     $htmltable->data = $buttonarray;
     $mform->addElement('static', 'buttonar', '', html_writer::table($htmltable));
     $mform->closeHeaderBefore('buttonar');
 }
开发者ID:advancingdesign,项目名称:moodle-tool_mergeusers,代码行数:47,代码来源:review_form.php

示例2: print_collapsible_region_start

     }
 }
 if (has_capability('mod/workshop:overridegrades', $workshop->context)) {
     print_collapsible_region_start('', 'workshop-viewlet-cleargrades', get_string('toolbox', 'workshop'), false, true);
     echo $output->box_start('generalbox toolbox');
     // Clear aggregated grades
     $url = new moodle_url($workshop->toolbox_url('clearaggregatedgrades'));
     $btn = new single_button($url, get_string('clearaggregatedgrades', 'workshop'), 'post');
     $btn->add_confirm_action(get_string('clearaggregatedgradesconfirm', 'workshop'));
     echo $output->container_start('toolboxaction');
     echo $output->render($btn);
     echo $output->help_icon('clearaggregatedgrades', 'workshop');
     echo $output->container_end();
     // Clear assessments
     $url = new moodle_url($workshop->toolbox_url('clearassessments'));
     $btn = new single_button($url, get_string('clearassessments', 'workshop'), 'post');
     $btn->add_confirm_action(get_string('clearassessmentsconfirm', 'workshop'));
     echo $output->container_start('toolboxaction');
     echo $output->render($btn);
     echo $output->help_icon('clearassessments', 'workshop');
     echo html_writer::empty_tag('img', array('src' => $output->pix_url('i/risk_dataloss'), 'title' => get_string('riskdatalossshort', 'admin'), 'alt' => get_string('riskdatalossshort', 'admin'), 'class' => 'workshop-risk-dataloss'));
     echo $output->container_end();
     echo $output->box_end();
     print_collapsible_region_end();
 }
 if (has_capability('mod/workshop:submit', $PAGE->context)) {
     print_collapsible_region_start('', 'workshop-viewlet-ownsubmission', get_string('yoursubmission', 'workshop'));
     echo $output->box_start('generalbox ownsubmission');
     if ($submission = $workshop->get_submission_by_author($USER->id)) {
         echo $output->render($workshop->prepare_submission_summary($submission, true));
     } else {
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:view.php

示例3: notice

// Get previous cert record
if (!($certrecord = $DB->get_record('iomadcertificate_issues', array('userid' => $USER->id, 'iomadcertificateid' => $iomadcertificate->id)))) {
    notice(get_string('noiomadcertificatesissued', 'iomadcertificate'), "{$CFG->wwwroot}/course/view.php?id={$course->id}");
    die;
}
// Load the specific iomadcertificatetype
require "{$CFG->dirroot}/mod/iomadcertificate/type/{$iomadcertificate->iomadcertificatetype}/iomadcertificate.php";
if ($action) {
    // Remove full-stop at the end if it exists, to avoid "..pdf" being created and being filtered by clean_filename
    $certname = rtrim($iomadcertificate->name, '.');
    $filename = clean_filename("{$certname}.pdf");
    $pdf->Output($filename, 'I');
    // open in browser
    exit;
}
echo $OUTPUT->header();
if (has_capability('mod/iomadcertificate:manage', $context)) {
    $numusers = count(iomadcertificate_get_issues($iomadcertificate->id, 'ci.timecreated ASC', '', $cm));
    $url = html_writer::tag('a', get_string('viewiomadcertificateviews', 'iomadcertificate', $numusers), array('href' => $CFG->wwwroot . '/mod/iomadcertificate/report.php?id=' . $cm->id));
    echo html_writer::tag('div', $url, array('class' => 'reportlink'));
}
if (!empty($iomadcertificate->intro)) {
    echo $OUTPUT->box(format_module_intro('iomadcertificate', $iomadcertificate, $cm->id), 'generalbox', 'intro');
}
echo html_writer::tag('p', get_string('viewed', 'iomadcertificate') . '<br />' . userdate($certrecord->timecreated), array('style' => 'text-align:center'));
$link = new moodle_url('/mod/iomadcertificate/review.php?id=' . $cm->id . '&action=get');
$linkname = get_string('reviewiomadcertificate', 'iomadcertificate');
$button = new single_button($link, $linkname);
$button->add_action(new popup_action('click', $link, array('height' => 600, 'width' => 800)));
echo html_writer::tag('div', $OUTPUT->render($button), array('style' => 'text-align:center'));
echo $OUTPUT->footer($course);
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:review.php

示例4: print_start_attempt_button

 public function print_start_attempt_button($canpreview, $buttontext, $unfinished)
 {
     global $OUTPUT;
     $url = $this->_readerobj->start_attempt_url();
     $button = new single_button($url, $buttontext);
     $button->class .= ' quizstartbuttondiv';
     if (!$unfinished) {
         $strconfirmstartattempt = $this->confirm_start_attempt_message();
         if ($strconfirmstartattempt) {
             $button->add_action(new confirm_action($strconfirmstartattempt, null, get_string('startattempt', 'quiz')));
         }
     }
     $warning = '';
     if ($this->securewindow_required($canpreview)) {
         $button->class .= ' quizsecuremoderequired';
         $button->add_action(new popup_action('click', $url, 'quizpopup', securewindow_access_rule::$popupoptions));
         $warning = html_writer::tag('noscript', $OUTPUT->heading(get_string('noscript', 'quiz')));
     }
     return $OUTPUT->render($button) . $warning;
 }
开发者ID:e-rasvet,项目名称:reader,代码行数:20,代码来源:accessrules.php

示例5: view_default

 public function view_default(moodle_url $url, $canmanage)
 {
     global $CFG, $OUTPUT, $USER;
     if (!$url->get_param('action')) {
         echo $OUTPUT->header();
         if ($canmanage) {
             $this->show_tabs($url);
         }
         // Check if the user can view the certificate
         if (!$canmanage && ($msg = $this->can_issue($USER))) {
             notice($msg, $CFG->wwwroot . '/course/view.php?id=' . $this->get_course()->id, $this->get_course());
             die;
         }
         if (!empty($this->get_instance()->intro)) {
             echo $OUTPUT->box(format_module_intro('simplecertificate', $this->get_instance(), $this->coursemodule->id), 'generalbox', 'intro');
         }
         if ($attempts = $this->get_attempts()) {
             echo $this->print_attempts($attempts);
         }
         if (!$canmanage) {
             $this->add_to_log('view');
         }
         if ($this->get_instance()->delivery != 3 || $canmanage) {
             // Create new certificate record, or return existing record
             $certrecord = $this->get_issue();
             switch ($this->get_instance()->delivery) {
                 case self::OUTPUT_FORCE_DOWNLOAD:
                     $str = get_string('opendownload', 'simplecertificate');
                     break;
                 case self::OUTPUT_SEND_EMAIL:
                     $str = get_string('openemail', 'simplecertificate');
                     break;
                 default:
                     $str = get_string('openwindow', 'simplecertificate');
                     break;
             }
             echo html_writer::tag('p', $str, array('style' => 'text-align:center'));
             $linkname = get_string('getcertificate', 'simplecertificate');
             $link = new moodle_url('/mod/simplecertificate/view.php', array('id' => $this->coursemodule->id, 'action' => 'get'));
             $button = new single_button($link, $linkname);
             $button->add_action(new popup_action('click', $link, 'view' . $this->coursemodule->id, array('height' => 600, 'width' => 800)));
             echo html_writer::tag('div', $OUTPUT->render($button), array('style' => 'text-align:center'));
         }
         echo $OUTPUT->footer();
     } else {
         // Output to pdf
         if ($this->get_instance()->delivery != 3 || $canmanage) {
             $this->output_pdf($this->get_issue($USER));
         }
     }
 }
开发者ID:seducto,项目名称:moodle-mod_simplecertificate,代码行数:51,代码来源:locallib.php

示例6: array

echo html_writer::checkbox('name', 'value', false, null, array('id' => 'checkbox1'));
echo html_writer::tag('p', 'A confirm form with continue/cancel options (just providing urls to go to):');
$continueurl = new moodle_url('index.php');
$cancelurl = new moodle_url('index.php');
echo $OUTPUT->confirm('This is the message', $continueurl, $cancelurl);
echo html_writer::tag('p', 'A confirm form with continue/cancel options (with custom buttons):');
$continueurl = new moodle_url('index.php');
$cancelurl = new moodle_url('index.php');
$continuebutton = new single_button($continueurl, 'Custom Button text', 'post');
$cancelbutton = new single_button($cancelurl, 'Something else', 'get');
echo $OUTPUT->confirm('This is another message', $continuebutton, $cancelbutton);
echo html_writer::tag('p', 'A standalone single button. This is still wrapped in a form so you can submit it. There are a couple of ways to generate, via a function call:');
echo $OUTPUT->single_button($continueurl, 'A disabled button', 'post', array('disabled' => true));
echo html_writer::tag('p', 'Or manually create object then render. Note this uses a confirm dialog, try pressing to see popup (needs styling)');
// render directly
$button = new single_button($continueurl, 'Manually rendered button', 'post');
$button->tooltip = 'This is the tooltip';
$button->formid = 'canbeset';
$button->class = 'classonbutton';
$button->add_confirm_action('This message appears to confirm when you push the button');
echo $OUTPUT->render($button);
echo html_writer::tag('p', 'A single select form. Quick way using a function:');
$url = new moodle_url('index.php', array('urlparams' => 'become', 'hidden' => 'fields'));
$options = array(1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four');
echo $OUTPUT->single_select($url, 'youpicked', $options, '', array('' => 'choose'), 'formid');
echo html_writer::tag('p', 'A single select form. Manually rendered:');
$select = new single_select($url, 'youpicked', $options);
$select->set_label('This is a label for the select');
$select->tooltip = 'This is the tooltip';
//this doesn't seem to work - moodle bug?
//$select->add_confirm_action('Confirm you want to do this');
开发者ID:jeisc,项目名称:totara-element-library,代码行数:31,代码来源:forms.php

示例7: foreach

foreach ($attemptobj->get_question_iterator() as $number => $question) {
    if ($question->length == 0) {
        continue;
    }
    $flag = '';
    if ($attemptobj->is_question_flagged($question->id)) {
        $flag = ' <img src="' . $OUTPUT->pix_url('i/flagged') . '" alt="' . get_string('flagged', 'question') . '" class="questionflag" />';
    }
    $row = array('<a href="' . s($attemptobj->attempt_url($question->id)) . '">' . $number . $flag . '</a>', get_string($attemptobj->get_question_status($question->id), 'quiz'));
    if ($scorescolumn) {
        $row[] = $attemptobj->get_question_score($question->id);
    }
    $table->data[] = $row;
}
/// Print the summary table.
echo html_writer::table($table);
/// countdown timer
echo $attemptobj->get_timer_html();
/// Finish attempt button.
echo $OUTPUT->container_start('submitbtns mdl-align');
$options = array('attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'questionids' => '', 'sesskey' => sesskey());
$button = new single_button(new moodle_url($attemptobj->processattempt_url(), $options), get_string('submitallandfinish', 'quiz'));
$button->id = 'responseform';
$button->add_confirm_action(get_string('confirmclose', 'quiz'));
echo $OUTPUT->container_start('controls');
echo $OUTPUT->render($button);
echo $OUTPUT->container_end();
echo $OUTPUT->container_end();
/// Finish the page
$accessmanager->show_attempt_timer_if_needed($attemptobj->get_attempt(), time());
echo $OUTPUT->footer();
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:summary.php

示例8: moodle_url

}
// Export button
if ($canexport) {
    if ($exporturl === '') {
        echo $OUTPUT->single_button(new moodle_url('/mod/groupselect/view.php', array('id' => $cm->id, 'export' => true)), get_string('export', 'mod_groupselect'));
    } else {
        echo '<div class="export_url" >';
        echo $OUTPUT->action_link($exporturl, get_string('export_download', 'mod_groupselect'));
        echo '</div> <br>';
    }
}
// Assign button
if ($canassign and count($groups) > 0) {
    $action = new confirm_action(get_string('assigngroup_confirm', 'mod_groupselect'), 'openpopup');
    $action->jsfunctionargs['callbackargs'] = array(null, array('url' => new moodle_url('/mod/groupselect/view.php', array('id' => $cm->id, 'assign' => true))));
    $button = new single_button(new moodle_url('/mod/groupselect/view.php', array('id' => $cm->id, 'assign' => true)), get_string('assigngroup', 'mod_groupselect'));
    $button->add_action($action);
    echo $OUTPUT->render($button);
}
if (empty($groups)) {
    echo $OUTPUT->notification(get_string('nogroups', 'mod_groupselect'));
} else {
    if ($problems) {
        foreach ($problems as $problem) {
            echo $OUTPUT->notification($problem, 'notifyproblem');
        }
    }
    $data = array();
    $actionpresent = false;
    $assigned_relation = $DB->get_records_sql("SELECT g.id AS rid, g.teacherid AS id, g.groupid\n    \t\t\t\t\t\t\t\t\t\t\tFROM  {groupselect_groups_teachers} g\n    \t\t\t\t\t\t\t\t\t     \tWHERE g.instance_id = ?", array('instance_id' => $id));
    $assigned_teacher_ids = array();
开发者ID:nwp90,项目名称:moodle-mod_groupselect,代码行数:31,代码来源:view.php

示例9: get_string

                echo '<li>' . $l->description . '</li>';
            }
            echo '</ul>';
        } else {
        }
    } else {
        echo get_string('explanationmessage', 'block_course_files_license');
    }
    echo '</p>';
    echo $OUTPUT->heading(get_string('not_identified_course_files', 'block_course_files_license'), 3, 'main');
    echo '<form action="' . $_SERVER['PHP_SELF'] . '?courseid=' . $courseid . '" method="POST">';
    echo html_writer::table($table);
    echo '<p class="text-center">';
    echo '<button type="submit" class="btn btn-success btn-sm"><i class="fa fa-check-square-o"></i> ';
    echo get_string('savebutton', 'block_course_files_license');
    echo '</button>';
    echo '</p>';
    echo '</form>';
} else {
    echo '<div class="alert alert-success" role="alert"><i class="fa fa-thumbs-o-up"></i> ' . get_string('all_files_identified', 'block_course_files_license') . '</div>';
}
if ($identifiedfileslist) {
    echo $OUTPUT->heading(get_string('identified_course_files', 'block_course_files_license'), 3, 'main');
    echo html_writer::table($identified_table);
    $action = new confirm_action(get_string('confirm_delete_all_records', 'block_course_files_license'), 'openpopup');
    $action->jsfunctionargs['callbackargs'] = array(null, array('url' => $PAGE->url->out(false, array('confirmed' => 'true'))));
    $button = new single_button(new moodle_url('/blocks/course_files_license/delete.php', array('courseid' => $courseid, 'all' => 'true'), array('class' => 'btn btn-sm btn-danger')), get_string('delete_all_records', 'block_course_files_license'));
    $button->add_action($action);
    echo '<div style="width:100%;text-align:center;">' . $OUTPUT->render($button) . '</div>';
}
echo $OUTPUT->footer();
开发者ID:adrianrv,项目名称:moodle-block_course_files_license,代码行数:31,代码来源:view.php

示例10: make_review_link

 /**
  * Make a link to the review page for an attempt.
  *
  * @param string $linktext the desired link text.
  * @param int $attemptid the attempt id.
  * @return string HTML for the link.
  */
 public function make_review_link($linktext, $attemptid) {
     global $OUTPUT;
     $url = $this->_quizobj->review_url($attemptid);
     $button = new single_button($url, $linktext);
     $button->add_action(new popup_action('click', $url, 'quizpopup', self::$popupoptions));
     return $OUTPUT->render($button);
 }
开发者ID:ravivare,项目名称:moodle-1,代码行数:14,代码来源:accessrules.php

示例11: summary_page_controls

    /**
     * Creates any controls a the page should have.
     *
     * @param quiz_attempt $attemptobj
     */
    public function summary_page_controls($attemptobj) {
        $output = '';
        // countdown timer
        $output .= $this->countdown_timer();

        // Finish attempt button.
        $output .= $this->container_start('submitbtns mdl-align');
        $options = array(
            'attempt' => $attemptobj->get_attemptid(),
            'finishattempt' => 1,
            'timeup' => 0,
            'slots' => '',
            'sesskey' => sesskey(),
        );

        $button = new single_button(
                new moodle_url($attemptobj->processattempt_url(), $options),
                get_string('submitallandfinish', 'quiz'));
        $button->id = 'responseform';
        $button->add_confirm_action(get_string('confirmclose', 'quiz'));

        $output .= $this->container_start('controls');
        $output .= $this->render($button);
        $output .= $this->container_end();
        $output .= $this->container_end();

        return $output;
    }
开发者ID:nottmoo,项目名称:moodle,代码行数:33,代码来源:renderer.php

示例12: add_to_log

        echo $OUTPUT->render($button);
        echo '</center>';
        add_to_log($course->id, 'certificate', 'received', "view.php?id=$cm->id", $certificate->id, $cm->id);
        echo $OUTPUT->footer($course);
        exit;
    }
    certificate_issue($course, $certificate, $certrecord, $cm); // update certrecord as issued
} else if ($certrecord->certdate > 0) { // Review certificate
*/
if (empty($action)) {
    view_header($course, $certificate, $cm);
    $link = new moodle_url('/mod/certificate/view.php?id=' . $cm->id . '&action=get');
    echo '<p align="center">' . get_string('viewed', 'certificate') . '<br />' . userdate($certrecord->certdate) . '</p>';
    echo '<center>';
    $linkname = $strreviewcertificate;
    $button = new single_button($link, $linkname);
    $button->add_action(new popup_action('click', $link, 'view' . $cm->id, array('height' => 600, 'width' => 800)));
    echo $OUTPUT->render($button);
    echo '</center>';
    echo $OUTPUT->footer($course);
    exit;
}
/*
} else if ($certrecord->certdate == 0) { //Create certificate
    if (empty($action)) {
        view_header($course, $certificate, $cm);
        if ($certificate->delivery == 0)    {
            echo '<p align="center">'.get_string('openwindow', 'certificate').'</p>';
        } elseif ($certificate->delivery == 1)    {
            echo '<p align="center">'.get_string('opendownload', 'certificate').'</p>';
        } elseif ($certificate->delivery == 2)    {
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:31,代码来源:certificate_view.php

示例13: html_table

        $table = new html_table();
        $table->class = 'generaltable';
        $table->head = array(get_string('issued', 'customcert'));
        $table->align = array('left');
        $table->attributes = array('style' => 'width:20%; margin:auto');
        foreach ($issues as $issue) {
            $row = array();
            $row[] = userdate($issue->timecreated);
            $table->data[$issue->id] = $row;
        }
        $issuelist = $header . html_writer::table($table) . "<br />";
    }
    // Create the button to download the customcert.
    $linkname = get_string('getcustomcert', 'customcert');
    $link = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id, 'action' => 'download'));
    $downloadbutton = new single_button($link, $linkname);
    $downloadbutton->add_action(new popup_action('click', $link, 'customcertpopup', array('height' => 600, 'width' => 800)));
    $downloadbutton = html_writer::tag('div', $OUTPUT->render($downloadbutton), array('style' => 'text-align:center'));
    // Output all the page data.
    echo $OUTPUT->header();
    groups_print_activity_menu($cm, $pageurl);
    echo $reportlink;
    echo $intro;
    echo $issuelist;
    echo $downloadbutton;
    echo $OUTPUT->footer($course);
    exit;
} else {
    // Output to pdf
    // Create new customcert issue record if one does not already exist.
    if (!$DB->record_exists('customcert_issues', array('userid' => $USER->id, 'customcertid' => $customcert->id))) {
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:31,代码来源:view.php

示例14: close_window_button

    /**
     * Returns HTML to display a simple button to close a window
     *
     * @param string $text The lang string for the button's label (already output from get_string())
     * @return string html fragment
     */
    public function close_window_button($text='') {
        if (empty($text)) {
            $text = get_string('closewindow');
        }
        $button = new single_button(new moodle_url('#'), $text, 'get');
        $button->add_action(new component_action('click', 'close_window'));

        return $this->container($this->render($button), 'closewindow');
    }
开发者ID:afgal,项目名称:moodle-1,代码行数:15,代码来源:outputrenderers.php

示例15: review_link

    /**
     * Output either a link to the review page for an attempt, or a button to
     * open the review in a popup window.
     *
     * @param moodle_url $url of the target page.
     * @param bool $reviewinpopup whether a pop-up is required.
     * @param array $popupoptions options to pass to the popup_action constructor.
     * @return string HTML to output.
     */
    public function review_link($url, $reviewinpopup, $popupoptions) {
        if ($reviewinpopup) {
            $button = new single_button($url, get_string('review', 'quiz'));
            $button->add_action(new popup_action('click', $url, 'quizpopup', $popupoptions));
            return $this->render($button);

        } else {
            return html_writer::link($url, get_string('review', 'quiz'),
                    array('title' => get_string('reviewthisattempt', 'quiz')));
        }
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:20,代码来源:renderer.php


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