コード例 #1
0
 public static function sign_up_sign_in($url)
 {
     // TODO: add sign in as guest.
     $dropdown_content = array('class' => 'dropdown-menu', 'style' => 'padding: 15px; padding-bottom: 0px;');
     $form = array('method' => 'post', 'action' => $url, 'accept-charset' => 'UTF-8');
     $username = array('type' => 'text', 'placeholder' => 'Username', 'id' => 'username', 'name' => 'username');
     $password = array('type' => 'password', 'placeholder' => 'Password', 'id' => 'password', 'name' => 'password');
     $submit = array('value' => 'Sign In', 'class' => 'btn btn-primary btn-block', 'id' => 'sign-in');
     return html::ul('nav pull-right', html::li(html::a(new moodle_url('/login/signup.php'), 'Sign Up')) . bootstrap::list_divider() . bootstrap::dropdown('Sign In', html::div($dropdown_content, html::form($form, html::input($username) . html::input($password) . html::checkbox('rememberusername', 'Remember username') . html::submit($submit)))));
 }
コード例 #2
0
<?php

echo html::formStart('bestSelldWidg' . $this->post->ID, array('attrs' => 'onsubmit="toeAddToCart(this, \'\', true); return false;"', 'method' => 'POST'));
?>
	<?php 
//echo html::text('qty', array('value' => 1))
?>
	<?php 
echo html::hidden('addQty', array('value' => 1));
?>
	<?php 
echo html::hidden('mod', array('value' => 'user'));
?>
	<?php 
echo html::hidden('action', array('value' => 'addToCart'));
?>
	<?php 
echo html::hidden('pid', array('value' => $this->post->ID));
?>
	<?php 
echo html::hidden('reqType', array('value' => 'ajax'));
?>
	<?php 
echo html::submit('add', array('value' => lang::_('Add')));
?>
	<div class="toeAddToCartMsg"></div>
<?php 
echo html::formEnd();
コード例 #3
0
 /**
  * @dataProvider submits
  */
 public function test_submit($attributes, $expected)
 {
     $actual = html::submit($attributes);
     $this->assertSame($expected, $actual);
 }
コード例 #4
0
ファイル: common.php プロジェクト: gpawlik/suited-php-classes
/**
 * function that displays user add form
 */
function web_install_user_form()
{
    $form = new html();
    $form->formStart();
    $form->init(null, 'submit');
    $form->legend('Add User');
    $form->label('email', 'Enter email of user:'******'email');
    $form->label('pass1', 'Enter password');
    $form->password('pass1');
    $form->label('pass2', 'Retype password');
    $form->password('pass2');
    $form->submit('submit', 'Submit');
    $form->formEnd();
    echo $form->getStr();
}
コード例 #5
0
 protected function render_single_select(single_select $select)
 {
     $select = clone $select;
     if (empty($select->formid)) {
         $select->formid = html_writer::random_id('single_select_f');
     }
     $params = $select->url->params();
     if ($select->method === 'post') {
         $params['sesskey'] = sesskey();
     }
     $output = html::hidden_inputs($params);
     if (empty($select->attributes['id'])) {
         $select->attributes['id'] = html_writer::random_id('single_select');
     }
     if ($select->disabled) {
         $select->attributes['disabled'] = 'disabled';
     }
     if ($select->tooltip) {
         $select->attributes['title'] = $select->tooltip;
     }
     if ($select->label) {
         $attributes = $select->labelattributes;
         $attributes['for'] = $select->attributes['id'];
         $output .= html::label($attributes, $select->label);
     }
     if ($select->helpicon instanceof help_icon) {
         $output .= $this->render($select->helpicon);
     } else {
         if ($select->helpicon instanceof old_help_icon) {
             $output .= $this->render($select->helpicon);
         }
     }
     $output .= html_writer::select($select->options, $select->name, $select->selected, $select->nothing, $select->attributes);
     $go = html::submit(get_string('go'));
     $output .= '<noscript>' . html::div(array('style' => 'inline'), $go) . '</noscript>';
     $nothing = empty($select->nothing) ? false : key($select->nothing);
     $this->page->requires->js_init_call('M.util.init_select_autosubmit', array($select->formid, $select->attributes['id'], $nothing));
     $output = html::div($output);
     if ($select->method === 'get') {
         $url = $select->url->out_omit_querystring(true);
         // url without params, the anchor part allowed
     } else {
         $url = $select->url->out_omit_querystring();
         // url without params, the anchor part not allowed
     }
     $form_attributes = array('method' => $select->method, 'class' => 'form-inline', 'action' => $url, 'id' => $select->formid);
     $output = html::form($form_attributes, $output);
     return html::div($select->class, $output);
 }
 public function render_backup_files_viewer(backup_files_viewer $viewer)
 {
     $files = $viewer->files;
     $table = new html_table();
     $table->attributes['class'] = 'table table-striped table-hover';
     $table->head = array(get_string('filename', 'backup'), get_string('time'), get_string('size'), get_string('download'), get_string('restore'));
     $table->data = array();
     foreach ($files as $file) {
         if ($file->is_directory()) {
             continue;
         }
         $fileurl = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), null, $file->get_filepath(), $file->get_filename(), true);
         $params = array();
         $params['action'] = 'choosebackupfile';
         $params['filename'] = $file->get_filename();
         $params['filepath'] = $file->get_filepath();
         $params['component'] = $file->get_component();
         $params['filearea'] = $file->get_filearea();
         $params['filecontextid'] = $file->get_contextid();
         $params['contextid'] = $viewer->currentcontext->id;
         $params['itemid'] = $file->get_itemid();
         $restoreurl = new moodle_url('/backup/restorefile.php', $params);
         $table->data[] = array($file->get_filename(), userdate($file->get_timemodified()), display_size($file->get_filesize()), html_writer::link($fileurl, get_string('download')), html_writer::link($restoreurl, get_string('restore')));
     }
     $html = html_writer::table($table);
     $html .= html::submit(array('value' => get_string('managefiles', 'backup'), 'class' => 'btn-primary'));
     $url = new moodle_url('/backup/backupfilesedit.php', array('currentcontext' => $viewer->currentcontext->id, 'contextid' => $viewer->filecontext->id, 'filearea' => $viewer->filearea, 'component' => $viewer->component, 'returnurl' => $this->page->url->out()));
     return form::moodle_url($url, $html);
 }
コード例 #7
0
                    echo html::hidden('action', array('value' => 'updateCart'));
                    ?>
							<?php 
                    echo html::hidden('mod', array('value' => 'user'));
                    ?>
							<?php 
                    /** @deprecated @see inCartId key, but DO NOT delete this*/
                    ?>
							<?php 
                    echo html::hidden('pid', array('value' => $c['pid']));
                    ?>
							<?php 
                    /*****/
                    ?>
							<?php 
                    echo html::submit('update', array('value' => lang::_('Update'), 'attrs' => 'class="update_qty"'));
                    ?>
							<div id="qty_update_msg_<?php 
                    echo $inCartId;
                    ?>
"></div>
							<?php 
                    echo html::formEnd();
                    ?>
                        <?php 
                } else {
                    if ($this->canEdit && $c['gift']) {
                        //Show this for gifts
                        echo html::formStart('qty_cart', array('action' => '', 'attrs' => 'class="cartQtyUpdate"'));
                        echo html::hidden('inCartId', array('value' => $inCartId));
                        echo html::formEnd();
コード例 #8
0
ファイル: dev.php プロジェクト: volodymyr-volynets/frontend
 /**
  * Names action
  */
 public function action_names()
 {
     $input = request::input();
     // legend
     echo self::render_topic('names');
     // code naming conventions
     echo html::a(['name' => 'code']);
     echo '<h3>Naming Conventions: Code</h3>';
     echo object_name_code::explain(null, ['html' => true]);
     // testing form
     echo html::a(['name' => 'code_test']);
     echo '<h3>Test name</h3>';
     if (!empty($input['submit_yes'])) {
         $result = object_name_code::check($input['type'] ?? null, $input['name'] ?? null);
         if (!$result['success']) {
             echo html::message(['options' => $result['error'], 'type' => 'danger']);
         } else {
             echo html::message(['options' => 'Name is good!', 'type' => 'success']);
         }
     }
     $ms = 'Name: ' . html::input(['name' => 'name', 'value' => $input['name'] ?? null]) . ' ';
     $ms .= 'Type: ' . html::select(['name' => 'type', 'options' => object_name_code::$types, 'value' => $input['type'] ?? null]) . ' ';
     $ms .= html::submit(['name' => 'submit_yes']);
     echo html::form(['name' => 'code', 'action' => '#code_test', 'value' => $ms]);
     // database naming convention
     echo '<br/><br/><hr/>';
     echo html::a(['name' => 'db']);
     echo '<h3>Naming Conventions: Database</h3>';
     echo object_name_db::explain(null, ['html' => true]);
     // testing form
     echo html::a(['name' => 'db_test']);
     echo '<h3>Test name</h3>';
     if (!empty($input['submit_yes2'])) {
         $result = object_name_db::check($input['type2'] ?? null, $input['name2'] ?? null);
         if (!$result['success']) {
             echo html::message(['options' => $result['error'], 'type' => 'danger']);
         } else {
             echo html::message(['options' => 'Name is good!', 'type' => 'success']);
         }
     }
     $ms = 'Name: ' . html::input(['name' => 'name2', 'value' => $input['name2'] ?? null]) . ' ';
     $ms .= 'Type: ' . html::select(['name' => 'type2', 'options' => object_name_db::$types, 'value' => $input['type2'] ?? null]) . ' ';
     $ms .= html::submit(['name' => 'submit_yes2']);
     echo html::form(['name' => 'db', 'action' => '#db_test', 'value' => $ms]);
 }
コード例 #9
0
echo html::hidden('addQty', array('value' => 1));
?>
        <?php 
echo html::hidden('mod', array('value' => 'user'));
?>
        <?php 
echo html::hidden('action', array('value' => 'addToCart'));
?>
        <?php 
echo html::hidden('pid', array('value' => $this->post->ID));
?>
        <?php 
echo html::hidden('reqType', array('value' => 'ajax'));
?>
        <?php 
echo html::submit('add', array('value' => lang::_('Thêm vào giỏ')));
?>
        </div>
    <?php 
/*if($this->useFormOnButtonsTpl) { ?>
      </form>
  <?php }*/
?>
    <div class="clear"></div>
    <?php 
if ($this->stockCheck && !$this->availableQty) {
    ?>
        <div class="toeErrorMsg"><?php 
    lang::_e('Please be advised that this product is out of stock');
    ?>
</div>
コード例 #10
0
 public static function actions($text)
 {
     return html::div('form-actions', html::submit(array('class' => 'btn-primary', 'value' => $text)));
 }
コード例 #11
0
		</tr>
        <tr>
            <td>
                <?php 
if (!empty($this->toeReturn)) {
    echo html::hidden('toeReturn', array('value' => $this->toeReturn));
}
?>
                <span class="toePasswordForgotLinkBox">
                    <a href="#" class="toeForgotPasswordLink"><?php 
lang::_e('Forgot password?');
?>
</a>
                </span>
                <?php 
echo html::submit('login', array('value' => lang::_('Sign In'), 'attrs' => 'class="tcf_submit" id="toeLoginFormSubmit"'));
?>
                <div id="toeLoginMsg"></div>
            </td>
        </tr>
		
    </table>
<?php 
if (!$this->fieldsOnly) {
    echo html::formEnd();
}
if (!empty($this->registrationLink)) {
    ?>
<div>
    <?php 
    lang::_e('If you have no account - you can');
コード例 #12
0
ファイル: base.php プロジェクト: volodymyr-volynets/frontend
 /**
  * Render list
  *
  * @return string
  */
 public final function render()
 {
     $result = '';
     // css & js
     layout::add_css('/numbers/media_submodules/numbers_frontend_html_list_media_css_base.css', 9000);
     layout::add_js('/numbers/media_submodules/numbers_frontend_html_list_media_js_base.js', 9000);
     // load mask
     numbers_frontend_media_libraries_loadmask_base::add();
     // hidden fields
     $result .= html::hidden(['name' => 'offset', 'id' => 'offset', 'value' => $this->offset]);
     $result .= html::hidden(['name' => 'limit', 'id' => 'limit', 'value' => $this->limit]);
     // get total number of rows from count datasource
     if (!empty($this->datasources['count'])) {
         $temp = factory::model($this->datasources['count']['model'])->get($this->datasources['count']['options']);
         $this->total = $temp[0]['count'] ?? 0;
     }
     // get rows
     if (!empty($this->datasources['data'])) {
         $this->rows = factory::model($this->datasources['data']['model'])->get($this->datasources['data']['options']);
         $this->num_rows = count($this->rows);
     }
     // new record
     if (object_controller::can('record_new')) {
         $mvc = application::get('mvc');
         $url = $mvc['controller'] . '/_edit';
         $this->actions['list_new'] = ['value' => 'New', 'sort' => -32000, 'icon' => 'file-o', 'href' => $url];
     }
     // filter
     if (!empty($this->filter)) {
         $this->actions['list_filter'] = ['value' => 'Filter', 'sort' => 1, 'icon' => 'filter', 'onclick' => "numbers.modal.show('list_{$this->list_link}_filter');"];
         $result .= numbers_frontend_html_list_filter::render($this);
     }
     // order by
     $this->actions['list_sort'] = ['value' => 'Sort', 'sort' => 2, 'icon' => 'sort-alpha-asc', 'onclick' => "numbers.modal.show('list_{$this->list_link}_sort');"];
     $result .= numbers_frontend_html_list_sort::render($this);
     // export, before pagination
     if (object_controller::can('list_export')) {
         // add export link to the panel
         $result .= numbers_frontend_html_list_export::render($this);
         $this->actions['list_export'] = ['value' => 'Export/Print', 'sort' => 3, 'icon' => 'print', 'onclick' => "numbers.modal.show('list_{$this->list_link}_export');"];
         // if we are exporting
         if (!empty($this->options['input']['submit_export']) && !empty($this->options['input']['export']['format'])) {
             $result .= numbers_frontend_html_list_export::export($this, $this->options['input']['export']['format']);
             goto finish;
         }
     }
     // refresh
     $this->actions['form_refresh'] = ['value' => 'Refresh', 'sort' => 32000, 'icon' => 'refresh', 'href' => 'javascript:location.reload();', 'internal_action' => true];
     // pagination top
     if (!empty($this->pagination['top'])) {
         $result .= factory::model($this->pagination['top'])->render($this, 'top');
     }
     // data
     $result .= '<hr class="simple"/>';
     if (method_exists($this, 'render_data')) {
         $result .= $this->render_data();
     } else {
         $result .= $this->render_data_default();
     }
     $result .= '<hr class="simple"/>';
     // pagination bottom
     if (!empty($this->pagination['bottom'])) {
         $result .= factory::model($this->pagination['bottom'])->render($this, 'bottom');
     }
     finish:
     $value = '';
     if (!empty($this->actions)) {
         $value .= '<div style="text-align: right;">' . $this->render_actions() . '</div>';
         $value .= '<hr class="simple" />';
     }
     // we add hidden submit element
     $result .= html::submit(['name' => 'submit_hidden', 'value' => 1, 'style' => 'display: none;']);
     // build a form
     $value .= html::form(['name' => "list_{$this->list_link}_form", 'id' => "list_{$this->list_link}_form", 'value' => $result, 'onsubmit' => 'return numbers.frontend_list.on_form_submit(this);']);
     // if we came from ajax we return as json object
     if (!empty($this->options['input']['__ajax'])) {
         $result = ['success' => true, 'html' => $value, 'js' => layout::$onload];
         layout::render_as($result, 'application/json');
     }
     $value = "<div id=\"list_{$this->list_link}_form_mask\"><div id=\"list_{$this->list_link}_form_wrapper\">" . $value . '</div></div>';
     $temp = ['type' => 'primary', 'value' => $value];
     return html::segment($temp);
 }