• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP open_html_tag函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: smarty_block_submit

/**
 * Render submit button
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_submit($params, $content, &$smarty, &$repeat)
{
    $params['type'] = 'submit';
    $accesskey = array_var($params, 'accesskey', 's');
    if ($accesskey) {
        $params['accesskey'] = 's';
    }
    // if
    $caption = clean(isset($params['not_lang']) ? $content : lang($content));
    if ($accesskey) {
        $first = null;
        $first_pos = null;
        $to_highlight = array(strtolower($accesskey), strtoupper($accesskey));
        foreach ($to_highlight as $accesskey_to_highlight) {
            if (($pos = strpos($caption, $accesskey_to_highlight)) === false) {
                continue;
            }
            // if
            if ($first_pos === null || $pos < $first_pos) {
                $first = $accesskey_to_highlight;
                $first_pos = $pos;
            }
            // if
        }
        // foreach
        if ($first !== null) {
            $caption = str_replace_first($first, "<u>{$first}</u>", $caption);
        }
        // if
    }
    // if
    // And done...
    return open_html_tag('button', $params) . '<span><span>' . $caption . '</span></span></button>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:43,代码来源:block.submit.php


示例2: smarty_function_object_user_star

/**
 * Render star for a given user page
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_user_star($params, &$smarty)
{
    static $ids = array();
    $starred_user_id = array_var($params, 'starred_user_id');
    $starred_page_type = array_var($params, 'starred_page_type');
    $starred_by_user_id = array_var($params, 'starred_by_user_id');
    $project_id = array_var($params, 'project_id');
    $id = array_var($params, 'id');
    if (empty($id)) {
        do {
            $id = 'object_star_' . make_string(40);
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME, $link);
    $query = "select * from healingcrystals_starred_user_pages where starred_by_user_id='" . $starred_by_user_id . "' and starred_user_id='" . $starred_user_id . "' and starred_page_type='" . $starred_page_type . "'";
    $result = mysql_query($query);
    $is_starred = false;
    if (mysql_num_rows($result)) {
        $is_starred = true;
    }
    mysql_close($link);
    if ($is_starred) {
        $params = array('id' => $id, 'href' => assemble_url('unstar_user_' . $starred_page_type . '_page', array('project_id' => $project_id, 'user_id' => $starred_by_user_id)) . '&starred_user_id=' . $starred_user_id, 'title' => lang('Unstar this object'), 'class' => 'object_star');
        $result = open_html_tag('a', $params) . '<img src="' . get_image_url('icons/star-small.gif') . '" alt="" /></a>';
    } else {
        $params = array('id' => $id, 'href' => assemble_url('star_user_' . $starred_page_type . '_page', array('project_id' => $project_id, 'user_id' => $starred_by_user_id)) . '&starred_user_id=' . $starred_user_id, 'title' => lang('Star this object'), 'class' => 'object_star');
        $result = open_html_tag('a', $params) . '<img src="' . get_image_url('icons/unstar-small.gif') . '" alt="" /></a>';
    }
    // if
    return $result . "\n<script type=\"text/javascript\">App.layout.init_star_unstar_link('" . $id . "')</script>";
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:41,代码来源:function.object_user_star.php


示例3: smarty_function_checkbox_field

/**
 * Render checkbox field
 * 
 * Parameters:
 * 
 * - name - Field name
 * - value - Initial value. Value of this field is ignored if checked attribute 
 *   is present
 * - array of additional attributes
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_checkbox_field($params, &$smarty)
{
    $params['type'] = 'checkbox';
    if (array_key_exists('checked', $params)) {
        if ($params['checked']) {
            $params['checked'] = 'checked';
        } else {
            unset($params['checked']);
        }
        // if
    }
    // if
    $class = array_var($params, 'class');
    if ($class == '') {
        $classes[] = 'inline';
        $classes[] = 'input_checkbox';
    } else {
        $classes = explode(' ', $class);
        if (!in_array('inline', $classes)) {
            $classes[] = 'inline';
        }
        // if
        $classes[] = 'input_checkbox';
    }
    // if
    $params['class'] = implode(' ', $classes);
    if (!isset($params['value'])) {
        $params['value'] = '1';
    }
    // if
    return open_html_tag('input', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:46,代码来源:function.checkbox_field.php


示例4: smarty_function_object_visibility

/**
 * Show object visibility if it's private
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_visibility($params, &$smarty)
{
    static $ids = array();
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is not valid instance of ProjectObject class', true);
    }
    // if
    if ($object->getVisibility() > VISIBILITY_PRIVATE) {
        return '';
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is expected to be an instance of User class', true);
    }
    // if
    if (!$user->canSeePrivate()) {
        return '';
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        do {
            $id = 'object_visibility_' . make_string(40);
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    return open_html_tag('a', array('href' => assemble_url('project_object_visibility', array('project_id' => $object->getProjectId(), 'object_id' => $object->getId())), 'title' => lang('Private :type', array('type' => Inflector::humanize($object->getType()))), 'class' => 'object_visibility', 'id' => $id)) . '<img src="' . get_image_url('private.gif') . '" alt="" /></a><script type="text/javascript">App.widgets.ObjectVisibility.init("' . $id . '");</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:function.object_visibility.php


示例5: smarty_function_with_successive_milestones

/**
 * with_successive_milestones helper
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_with_successive_milestones($params, &$smarty)
{
    static $counter = 1;
    $name = array_var($params, 'name');
    if (empty($name)) {
        return new InvalidParamError('name', $name, '$name value is required', true);
    }
    // if
    $milestone = array_var($params, 'milestone');
    if (!instance_of($milestone, 'Milestone')) {
        return new InvalidParamError('milestone', $milestone, '$milestone value is expected to be an instance of Milestone class', true);
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        $id = 'with_successive_milestones_' . $counter;
        $counter++;
    }
    // if
    $value = array_var($params, 'value');
    $action = array_var($value, 'action', 'dont_move');
    $milestones = array_var($value, 'milestones');
    if (!is_array($milestones)) {
        $milestones = array();
    }
    // if
    $logged_user = $smarty->get_template_vars('logged_user');
    $successive_milestones = Milestones::findSuccessiveByMilestone($milestone, STATE_VISIBLE, $logged_user->getVisibility());
    if (!is_foreachable($successive_milestones)) {
        return '<p class="details">' . lang('This milestone does not have any successive milestones') . '</p>';
    }
    // if
    $result = "<div class=\"with_successive_milestones\">\n<div class=\"options\">\n";
    $options = array('dont_move' => lang("Don't change anything"), 'move_all' => lang('Adjust all successive milestone by the same number of days'), 'move_selected' => lang('Adjust only selected successive milestones by the same number of days'));
    foreach ($options as $k => $v) {
        $radio = radio_field($name . '[action]', $k == $action, array('value' => $k, 'id' => $id . '_' . $k));
        $label = label_tag($v, $id . '_' . $k, false, array('class' => 'inline'), '');
        $result .= '<span class="block">' . $radio . ' ' . $label . "</span>\n";
    }
    // if
    $result .= "</div>\n<div class=\"successive_milestones\">";
    foreach ($successive_milestones as $successive_milestone) {
        $input_attributes = array('name' => $name . '[milestones][]', 'id' => $id . '_milestones_' . $successive_milestone->getId(), 'type' => 'checkbox', 'value' => $successive_milestone->getId(), 'class' => 'auto');
        if (in_array($successive_milestone->getId(), $milestones)) {
            $input_attributes['checked'] = true;
        }
        // if
        $input = open_html_tag('input', $input_attributes, true);
        $label = label_tag($successive_milestone->getName(), $id . '_milestones_' . $successive_milestone->getId(), false, array('class' => 'inline'), '');
        $result .= '<span class="block">' . $input . ' ' . $label . "</span>\n";
    }
    // foreach
    $result .= "</div>\n</div>\n";
    return $result;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:62,代码来源:function.with_successive_milestones.php


示例6: smarty_block_link

/**
 * Render button
 * 
 * Parameters:
 * 
 * - common anchor parameter
 * 
 * - method - if POST that this button will be send POST request. Method works 
 *   only if href parameter is present
 * - confirm - enforces confirmation dialog
 *   codes
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_link($params, $content, &$smarty, &$repeat)
{
    $href = '';
    if (isset($params['href'])) {
        $href = $params['href'];
        if (str_starts_with($href, '?')) {
            $href = assemble_from_string($params['href']);
        }
        // if
    }
    // if
    $params['href'] = $href;
    $confirm = '';
    if (array_key_exists('confirm', $params)) {
        $confirm = lang(trim($params['confirm']));
        unset($params['confirm']);
    }
    // if
    $post = false;
    if (array_key_exists('method', $params)) {
        if (strtolower($params['method']) == 'post') {
            $post = true;
        }
        // if
        unset($params['method']);
    }
    // if
    if ($post || $confirm) {
        $execution = $post ? 'App.postLink(' . var_export($href, true) . ')' : 'location.href = ' . var_export($href, true);
        if ($confirm) {
            $params['onclick'] = "if(confirm(" . var_export($confirm, true) . ")) { {$execution}; } return false;";
        } else {
            $params['onclick'] = "{$execution}; return false;";
        }
        // if
    }
    // if
    $not_lang = false;
    if (isset($params['not_lang'])) {
        $not_lang = (bool) $params['not_lang'];
        unset($params['not_lang']);
    }
    // if
    if (array_key_exists('id', $params) && strlen($params['id']) == 0) {
        unset($params['id']);
    }
    // if
    if (array_key_exists('title', $params)) {
        $params['title'] = lang($params['title']);
    }
    // if
    $text = $not_lang ? $content : lang($content);
    return open_html_tag('a', $params) . $text . '</a>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:72,代码来源:block.link.php


示例7: smarty_function_text_field

/**
 * Render input text
 * 
 * Parameters:
 * 
 * - name - field name
 * - value - initial value
 * - array of additional attributes
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_text_field($params, &$smarty)
{
    $type = 'text';
    if (!empty($params['type'])) {
        $type = array_var($params, 'type');
        unset($params['type']);
    }
    // if
    $params['type'] = $type;
    return open_html_tag('input', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:24,代码来源:function.text_field.php


示例8: smarty_function_select_tags

/**
 * Render select tags control
 * 
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_tags($params, &$smarty)
{
    $value = array_var($params, 'value', null, true);
    if (is_array($value)) {
        $value = implode(', ', $value);
    }
    // if
    $params['type'] = 'text';
    $params['value'] = $value;
    return open_html_tag('input', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:18,代码来源:function.select_tags.php


示例9: smarty_function_project_group_link

/**
 * Render project group link
 * 
 * Parameters:
 * 
 * - group - ProjectGroup
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_project_group_link($params, &$smarty)
{
    $group = array_var($params, 'group');
    if (!instance_of($group, 'ProjectGroup')) {
        return new InvalidParamError('group', $group, '$group is expected to be an instance of ProjectGroup class', true);
    }
    // if
    unset($params['group']);
    $params['href'] = $group->getViewUrl();
    return open_html_tag('a', $params) . clean($group->getName()) . '</a>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:22,代码来源:function.project_group_link.php


示例10: render_icon

 /**
 * Render icon IMG tag
 *
 * @access public
 * @param string $filename Icon filename
 * @param string $alt Value of alt attrbute for IMG
 * @param array $attributes Array of additional attributes
 * @return string
 */
 function render_icon($filename, $alt = '', $attributes = null) {
   if(is_array($attributes)) {
     $attributes['src'] = icon_url($filename);
     $attributes['alt'] = $alt;
   } else {
     $attributes = array(
       'src' => icon_url($filename),
       'alt' => $alt
     ); // array
   } // if
   return open_html_tag('img', $attributes, true);
 } // render_icon
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:21,代码来源:common.php


示例11: smarty_block_textarea_field

/**
 * Render textarea
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_textarea_field($params, $content, &$smarty, &$repeat)
{
    if (!isset($params['rows'])) {
        $params['rows'] = 10;
    }
    // if
    if (!isset($params['cols'])) {
        $params['cols'] = 48;
    }
    // if
    return open_html_tag('textarea', $params) . clean($content) . '</textarea>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:21,代码来源:block.textarea_field.php


示例12: smarty_function_image

/**
 * Generate image tag based on properties (same as for image_url)
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_image($params, &$smarty)
{
    require_once SMARTY_PATH . '/plugins/function.image_url.php';
    $name = array_var($params, 'name', null, true);
    $module = array_var($params, 'module', null, true);
    $params['src'] = smarty_function_image_url(array('name' => $name, 'module' => $module), $smarty);
    if (!isset($params['alt'])) {
        $params['alt'] = '';
    }
    // if
    return open_html_tag('img', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:19,代码来源:function.image.php


示例13: smarty_block_button

/**
 * Render button
 * 
 * Parameters:
 * 
 * - common button parameter
 * - href - when button is clicked this link is opened
 * - method - if POST that this button will be send POST request. Method works 
 *   only if href parameter is present
 * - confirm - enforces confirmation dialog
 * - not_lang - if true content will not be matched agains registered language 
 *   codes
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_button($params, $content, &$smarty, &$repeat)
{
    if (!isset($params['type'])) {
        $params['type'] = 'button';
    }
    // if
    $href = '';
    if (isset($params['href'])) {
        $href = $params['href'];
        if (str_starts_with($href, '?')) {
            $href = assemble_from_string($params['href']);
        }
        // if
        unset($params['href']);
    }
    // if
    $confirm = '';
    if (isset($params['confirm'])) {
        $confirm = trim($params['confirm']);
        unset($params['confirm']);
    }
    // if
    $post = false;
    if (isset($params['method'])) {
        $post = strtolower($params['method']) == 'post';
        unset($params['method']);
    }
    // if
    if ($href) {
        $execution = $post ? 'App.postLink(' . var_export($href, true) . ')' : 'location.href = ' . var_export($href, true);
        if ($confirm) {
            $params['onclick'] = "if(confirm(" . var_export($confirm, true) . ")) { {$execution}; } return false;";
        } else {
            $params['onclick'] = "{$execution}; return false;";
        }
        // if
    } else {
        if ($confirm) {
            $params['onclick'] = "return confirm(" . var_export($confirm, true) . ")";
        }
        // if
    }
    // if
    $not_lang = false;
    if (isset($params['not_lang'])) {
        $not_lang = (bool) $params['not_lang'];
        unset($params['not_lang']);
    }
    // if
    $text = $not_lang ? $content : lang($content);
    return open_html_tag('button', $params) . '<span><span>' . clean($text) . '</span></span></button>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:71,代码来源:block.button.php


示例14: smarty_block_wrap

/**
 * Wrap form field into a DIV
 * 
 * Properties:
 * 
 * - field - field name
 * - errors - errors container (ValidationErrors instance)
 * - show_errors - show errors list inside of field wrapper
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return null
 */
function smarty_block_wrap($params, $content, &$smarty, &$repeat)
{
    $field = array_var($params, 'field');
    if (empty($field)) {
        return new InvalidParamError('field', $field, "'field' property is required for 'wrap_field' helper", true);
    }
    // if
    $classes = array();
    if (isset($params['class'])) {
        $classes = explode(' ', $params['class']);
        unset($params['class']);
    }
    // if
    if (!in_array('ctrlHolder', $classes)) {
        $classes[] = 'ctrlHolder';
    }
    // if
    $error_messages = null;
    if (isset($params['errors'])) {
        $errors = $params['errors'];
    } else {
        $errors = $smarty->get_template_vars('errors');
    }
    // if
    if (instance_of($errors, 'ValidationErrors')) {
        if ($errors->hasError($field)) {
            $classes[] = 'error';
            $error_messages = $errors->getFieldErrors($field);
        }
        // if
    }
    // if
    $show_errors = array_var($params, 'show_errors', true);
    $listed_errors = '';
    if (is_foreachable($error_messages) && $show_errors) {
        require_once $smarty->_get_plugin_filepath('function', 'field_errors');
        $listed_errors = smarty_function_field_errors(array('field' => $field, 'errors' => $errors), $smarty);
    }
    // if
    $aid = array_var($params, 'aid');
    if ($aid) {
        $aid = '<p class="aid">' . clean(lang($aid)) . '</p>';
    }
    // if
    // Unset helper properties, we need this for attributes
    unset($params['field']);
    unset($params['errors']);
    unset($params['show_errors']);
    unset($params['aid']);
    $params['class'] = implode(' ', $classes);
    return open_html_tag('div', $params) . "\n{$listed_errors}\n" . $content . $aid . "\n</div>";
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:67,代码来源:block.wrap.php


示例15: smarty_function_invoice_link

/**
 * Display invoice link
 * 
 * Params:
 * 
 * - invoice
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_invoice_link($params, &$smarty)
{
    $invoice = array_var($params, 'invoice', null, true);
    if (!instance_of($invoice, 'Invoice')) {
        return new InvalidParamError('invoice', $invoice, '$invoice is expected to be an instance of Invoice class', true);
    }
    // if
    if (array_var($params, 'company')) {
        $params['href'] = $invoice->getCompanyViewUrl();
    } else {
        $params['href'] = $invoice->getViewUrl();
    }
    // if
    return open_html_tag('a', $params) . clean($invoice->getName()) . '</a>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:26,代码来源:function.invoice_link.php


示例16: smarty_function_select_project_permissions

/**
 * Render widgert
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_project_permissions($params, &$smarty)
{
    static $counter = 1;
    $id = array_var($params, 'id');
    if (empty($id)) {
        $id = 'select_project_permissions_' . $counter;
        $counter++;
    }
    // if
    $name = array_var($params, 'name');
    $value = array_var($params, 'value', array());
    $permissions = Permissions::findProject();
    if (is_foreachable($permissions)) {
        $levels = array(PROJECT_PERMISSION_NONE => lang('No Access'), PROJECT_PERMISSION_ACCESS => lang('Has Access'), PROJECT_PERMISSION_CREATE => lang('and Can Create'), PROJECT_PERMISSION_MANAGE => lang('and Can Manage'));
        $result = '<table class="select_project_permissions" id="' . clean($id) . '">
  	    <tr>
  	      <th>' . lang('Object') . '</th>
  	      <th colspan="4">' . lang('Permissions Level') . '</th>
  	    </tr>';
        $counter = 1;
        foreach ($permissions as $permission => $permission_name) {
            $permission_value = array_var($value, $permission);
            if ($permission_value === null) {
                $permission_value = PROJECT_PERMISSION_NONE;
            }
            // if
            $result .= '<tr class="' . ($counter % 2 ? 'odd' : 'even') . ' hoverable"><td class="permission_name"><span>' . $permission_name . '</span></td>';
            foreach ($levels as $level_value => $level_label) {
                $input_id = 'select_permission_' . $permission . '_' . $level_value;
                $input_attributes = array('name' => $name . '[' . $permission . ']', 'value' => $level_value, 'type' => 'radio', 'class' => 'inline', 'id' => $input_id);
                if ($level_value == $permission_value) {
                    $input_attributes['checked'] = 'checked';
                }
                // if
                $label_attributes = array('for' => $input_id, 'class' => 'inline');
                $cell_class = $level_value == PROJECT_PERMISSION_NONE ? 'no_access' : 'has_access';
                $result .= '<td class="permission_value ' . $cell_class . '">' . open_html_tag('input', $input_attributes, true) . ' ' . open_html_tag('label', $label_attributes) . clean($level_label) . '</label></td>';
            }
            // if
            $result .= '</tr>';
            $counter++;
        }
        // foreach
        return $result . '</table><script type="text/javascript">App.widgets.SelectProjectPermissions.init("' . clean($id) . '")</script>';
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:54,代码来源:function.select_project_permissions.php


示例17: smarty_function_yes_no

/**
 * Render yes - no widget
 * 
 * Parameters:
 * 
 * - name - name used for radio group
 * - value - if TRUE Yes will be selected, No will be selected otherwise
 * - yes - yes lang, default is 'Yes'
 * - no - no lang, default is 'No'
 * - id - ID base, if not present script will generate one
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_yes_no($params, &$smarty)
{
    static $ids;
    $name = array_var($params, 'name');
    if (empty($name)) {
        return new InvalidParamError('name', $name, "'name' paremeter is required for 'yes_no' helper", true);
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        if (!is_array($ids)) {
            $ids = array();
        }
        // if
        do {
            $id = 'yesNo' . rand();
        } while (in_array($id, $ids));
        $ids[] = $id;
    }
    // if
    $value = (bool) array_var($params, 'value');
    $yes_input_attributes = $no_input_attributes = array('name' => $name, 'type' => 'radio', 'class' => 'inline', 'disabled' => (bool) array_var($params, 'disabled'));
    // array
    $yes_input_attributes['id'] = $id . 'YesInput';
    $yes_input_attributes['value'] = '1';
    $no_input_attributes['id'] = $id . 'NoInput';
    $no_input_attributes['value'] = '0';
    $no_input_attributes['class'] = 'inline';
    if ($value) {
        $yes_input_attributes['checked'] = 'checked';
    } else {
        $no_input_attributes['checked'] = 'checked';
    }
    // if
    $onOff = (bool) array_var($params, 'on_off');
    if ($onOff) {
        $yesDisplay = lang("On");
        $noDisplay = lang("Off");
    } else {
        $yesDisplay = lang("Yes");
        $noDisplay = lang("No");
    }
    $yes = open_html_tag('label', array('for' => $yes_input_attributes['id'], 'class' => 'inline')) . open_html_tag('input', $yes_input_attributes, true) . array_var($params, 'yes', $yesDisplay) . '</label>';
    $no = open_html_tag('label', array('for' => $no_input_attributes['id'], 'class' => 'inline')) . open_html_tag('input', $no_input_attributes, true) . array_var($params, 'no', $noDisplay) . '</label>';
    return "<span class=\"yes_no\">{$yes} {$no}</span>";
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:61,代码来源:function.yes_no.php


示例18: smarty_function_role_permission_value

/**
 * Render role_permission_value widget
 * 
 * Params:
 * 
 * - permission - String - Permission name
 * - role - Role - System role
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_role_permission_value($params, &$smarty)
{
    $permission = array_var($params, 'permission');
    if (empty($permission)) {
        return new InvalidParamError('permission', $permission, '$permission value is exepected to be valid system permission name', true);
    }
    // if
    $role = array_var($params, 'role');
    if (!instance_of($role, 'Role')) {
        return new InvalidParamError('role', $role, '$role is exepected to be valid Role instance', true);
    }
    // if
    $yes_for_admins = array_var($params, 'yes_for_admins', true, true);
    $id = 'role_permission_value_' . $permission . '_' . $role->getId();
    $result = open_html_tag('input', array('type' => 'checkbox', 'class' => 'auto', 'checked' => $yes_for_admins ? $role->getPermissionValue('admin_access') || $role->getPermissionValue($permission) : $role->getPermissionValue($permission), 'id' => $id, 'set_permission_value_url' => $role->getSetPermissionValueUrl($permission), 'disabled' => $yes_for_admins && $role->getPermissionValue('admin_access')));
    return $result . '<script type="text/javascript">App.system.RolePermissionValue.init("' . $id . '")</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:29,代码来源:function.role_permission_value.php


示例19: smarty_block_label

/**
 * Render label
 * 
 * Paramteres:
 * 
 * - after_text - text that will be put after label text. Default is ''
 * - required - puts a star after label text if this field is required
 *
 * @param array $params
 * @param string $connect
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_label($params, $content, &$smarty, &$repeat)
{
    $after_text = '';
    if (isset($params['after_text'])) {
        $after_text = $params['after_text'];
        unset($params['after_text']);
    }
    // if
    $is_required = false;
    if (isset($params['required'])) {
        $is_required = (bool) $params['required'];
        unset($params['required']);
    }
    // if
    $not_lang = (bool) array_var($params, 'not_lang');
    $text = $not_lang ? $content : lang($content);
    $render_text = trim($text) . $after_text;
    if ($is_required) {
        $render_text = $render_text . '<em>*</em>';
    }
    // if
    return open_html_tag('label', $params) . $render_text . '</label>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:37,代码来源:block.label.php


示例20: smarty_function_object_star

/**
 * Render star for a given object
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_star($params, &$smarty)
{
    static $ids = array();
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is not valid instance of ProjectObject class', true);
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is expected to be an instance of User class', true);
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        do {
            $id = 'object_star_' . make_string(40);
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    if ($object->can_be_starred) {
        if ($object->isStarred($user)) {
            $params = array('id' => $id, 'href' => $object->getUnstarUrl(), 'title' => lang('Unstar this object'), 'class' => 'object_star');
            $result = open_html_tag('a', $params) . '<img src="' . get_image_url('icons/star-small.gif') . '" alt="" /></a>';
        } else {
            $params = array('id' => $id, 'href' => $object->getStarUrl(), 'title' => lang('Star this object'), 'class' => 'object_star');
            $result = open_html_tag('a', $params) . '<img src="' . get_image_url('icons/unstar-small.gif') . '" alt="" /></a>';
        }
        // if
        return $result . "\n<script type=\"text/javascript\">App.layout.init_star_unstar_link('" . $id . "')</script>";
    } else {
        return '';
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:43,代码来源:function.object_star.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP open_session函数代码示例发布时间:2022-05-15
下一篇:
PHP open_form函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap