コード例 #1
0
function show_georef_map($lon, $lat, $layer)
{
    $lang = sfContext::getInstance()->getUser()->getCulture();
    if (empty($layer)) {
        $layer = sfContext::getInstance()->getModuleName();
    }
    $html = '<div class="section" id="georef_container" style="display:none;">';
    $html .= '<div id="map" style="height:400px;width:100%">';
    $html .= '<div id="mapLoading">' . image_tag(sfConfig::get('app_static_url') . '/static/images/indicator.gif');
    $html .= __('Map is loading...') . '</div>';
    $html .= '</div>';
    $html .= '</div>';
    $async_map = sfConfig::get('app_async_map', false) && !sfContext::getInstance()->getRequest()->getParameter('debug', false);
    $js = "\n        C2C.map_init = function() {\n            Ext.get('georef_container').show();\n            var lon = Ext.getDom('lon') && Ext.getDom('lon').value || 0;\n            var lat = Ext.getDom('lat') && Ext.getDom('lat').value || 0;\n            c2corg.Map({\n                div: 'map',\n                lang: '{$lang}',\n                loading: 'mapLoading',\n                layers: ['{$layer}'],\n                connected: true,\n                georef: {\n                    initialState: {\n                        lon: lon,\n                        lat: lat,\n                        zoom: 15\n                    },\n                    callback: function(lonlat) {\n                        if (lonlat) {\n                            Ext.getDom('lon').value = Math.round(lonlat.lon*1E6)/1E6;\n                            Ext.getDom('lat').value = Math.round(lonlat.lat*1E6)/1E6;\n                        } else {\n                            Ext.getDom('lon').value = '';\n                            Ext.getDom('lat').value = '';\n                        }\n                        c2corg.coords.update_degminsec('lon');\n                        c2corg.coords.update_degminsec('lat');\n                    }\n                }\n            });\n        };";
    // asynchronous map loading
    if ($async_map) {
        use_helper('MyMinify');
        $c2c_script_url = minify_get_combined_files_url(array('/static/js/carto/build/carto.min.js', "/static/js/carto/build/lang-{$lang}.min.js", '/static/js/popup.js', '/static/js/carto/embedded.js'), (bool) sfConfig::get('app_minify_debug'));
        $js .= "C2C.async_map_init = function() {\n          \$.ajax({\n            url: '{$c2c_script_url}',\n            dataType: 'script',\n            cache: true\n          }).done(function() {\n            C2C.map_init();\n            Ext.EventManager.fireDocReady();\n          });\n        };";
    }
    // if coordinates not set, open automatically open the map
    if (!$lon && !$lat && !in_array($layer, array('sites', 'users', 'images', 'portals'))) {
        if ($async_map) {
            $js .= "C2C.async_map_init()";
        } else {
            $js .= "\$(window).load(C2C.map_init)";
        }
    }
    $html .= javascript_queue($js);
    return $html;
}
コード例 #2
0
ファイル: SettingController.php プロジェクト: sindotnet/cona
 /**
  * Saves the settings.
  */
 private final function _save()
 {
     $data = $_POST['setting'];
     // CSRF checks
     if (isset($_POST['csrf_token'])) {
         $csrf_token = $_POST['csrf_token'];
         if (!SecureToken::validateToken($csrf_token, BASE_URL . 'setting')) {
             Flash::set('error', __('Invalid CSRF token found!'));
             Observer::notify('csrf_token_invalid', AuthUser::getUserName());
             redirect(get_url('setting'));
         }
     } else {
         Flash::set('error', __('No CSRF token found!'));
         Observer::notify('csrf_token_not_found', AuthUser::getUserName());
         redirect(get_url('setting'));
     }
     if (!isset($data['allow_html_title'])) {
         $data['allow_html_title'] = 'off';
     }
     use_helper('Kses');
     $allowed = array('img' => array('src' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
     $data['admin_title'] = kses(trim($data['admin_title']), $allowed);
     Setting::saveFromData($data);
     Flash::set('success', __('Settings have been saved!'));
     redirect(get_url('setting'));
 }
コード例 #3
0
 public function update_event()
 {
     if (!isset($_POST['save'])) {
         Flash::set('error', __('Could not update this event!'));
     } else {
         use_helper('Kses');
         /* Prepare the data */
         $data = $_POST['event'];
         if (isset($data['id'])) {
             $data['id'] = kses(trim($data['id']), array());
         }
         $event = new CalendarEvent();
         if (isset($data['id'])) {
             $event->id = $data['id'];
             $event->created_by_id = $data['created_by_id'];
         }
         $event->title = $data['title'];
         $event->date_from = $data['date_from'];
         $event->date_to = $data['date_to'];
         $event->description = $data['description'];
         /* Check data and, if correct, save to DB */
         if ($event->checkData() && $event->save()) {
             if (isset($data['id'])) {
                 Flash::set('success', __('The event has been updated.'));
             } else {
                 Flash::set('success', __('A new event has been created.'));
             }
             redirect(get_url('plugin/calendar/events'));
         } else {
             Flash::setNow('error', __('There are errors in the form.'));
             $this->display(CALENDAR_VIEWS . '/update', array('event' => $event));
         }
     }
 }
コード例 #4
0
function file_link_to_add($entity, $entity_id, $options = array())
{
    // Convert options string to option array
    if (is_string($options)) {
        $options = _convert_string_option($options);
    }
    $label = 'Add file';
    // CUSTOMIZE LABEL TEXT
    if (isset($options['label'])) {
        $label = $options['label'];
    }
    // ICON
    if (isset($options['icon']) && $options['icon'] == 'true') {
        use_helper('sfIcon');
        $label = icon_tag('folder_add') . ' ' . $label;
    }
    $url = "files/create?entity={$entity}&entity_id={$entity_id}";
    // swicth link to with or without modalBox
    if (isset($options['modalbox']) && $options['modalbox'] == 'true') {
        use_helper('ModalBox');
        return m_link_to($label, $url);
    } else {
        return link_to($label, $url);
    }
}
コード例 #5
0
ファイル: PagerHelper.php プロジェクト: kotow/work
function stop_remote_pager()
{
    use_helper('Javascript');
    // until prototype implements a stop() method for the PeriodicalExecuter,
    // the following (almost a hack) is the only simple way to stop it
    return javascript_tag("pager_watch.callback = function () {};");
}
コード例 #6
0
function tab_tag($tab_name, $active_link, $active_tab, $url, $tab_class, $commCount = 0, $forum_link = false)
{
    $tab_title = __($tab_name . '_tab_help');
    $tab_text = __(ucfirst($tab_name));
    if ($commCount) {
        $tab_text = '<span class="reduced">' . $commCount . '</span>' . '<span>' . $tab_text . ' (' . $commCount . ')' . '</span>';
    } else {
        $tab_text = '<span>' . $tab_text . '</span>';
    }
    if ($forum_link) {
        if ($active_link) {
            use_helper('Forum');
            $link = f_link_to($tab_text, $url, array('class' => $tab_class, 'title' => $tab_title));
        } else {
            $link = '<div class="' . $tab_class . '" title="' . $tab_title . '">' . $tab_text . '</div>';
        }
    } else {
        $options_array = array('class' => $tab_class, 'title' => $tab_title);
        if (!$active_link) {
            $options_array['tag'] = 'div';
        }
        $link = link_to_if($active_link, $tab_text, $url, $options_array);
    }
    return '<li' . setActiveIf($tab_name, $active_tab) . '>' . $link . '</li>';
}
コード例 #7
0
function input_asset_tag($name, $value, $options = array())
{
    use_helper('Javascript', 'I18N');
    $type = 'all';
    if (isset($options['images_only'])) {
        $type = 'image';
        unset($options['images_only']);
    }
    $form_name = 'this.previousSibling.previousSibling.form.name';
    if (isset($options['form_name'])) {
        $form_name = '\'' . $options['form_name'] . '\'';
        unset($options['form_name']);
    }
    $html = '';
    if (is_file(sfConfig::get('sf_web_dir') . $value)) {
        $ext = substr($value, strpos($value, '.') - strlen($value) + 1);
        if (in_array($ext, array('png', 'jpg', 'gif'))) {
            $image_path = $value;
        } else {
            if (!is_file(sfConfig::get('sf_plugins_dir') . '/sfMediaLibraryPlugin/web/images/' . $ext . '.png')) {
                $ext = 'unknown';
            }
            $image_path = '/sfMediaLibraryPlugin/images/' . $ext;
        }
        $html .= link_to_function(image_tag($image_path, array('alt' => 'File', 'height' => '64')), "window.open('{$value}')");
        $html .= '<br />';
    }
    $html .= input_tag($name, $value, $options);
    $html .= '&nbsp;' . image_tag('/sfMediaLibraryPlugin/images/folder_open', array('alt' => __('Insert Image'), 'style' => 'cursor: pointer; vertical-align: middle', 'onclick' => 'sfMediaLibrary.openWindow({ form_name: ' . $form_name . ', field_name: \'' . $name . '\', type: \'' . $type . '\', scrollbars: \'yes\' })'));
    $html .= init_media_library();
    return $html;
}
コード例 #8
0
/**
 * Include a content slot in your template.
 * 
 * This replaces get_sympal_content_slot() and is intended to be easier
 * to use. This also taps into the app.yml config for its options
 * 
 * @param string $name The name of the slot
 * @param array  $options An array of options for this slot
 * 
 * Available options include
 *  * content         An sfSympalContent instance to render the slot for
 *  * type            The rendering type to use for this slot (e.g. Markdown)
 *  * default_value   A default value to give this slot the first time it's created
 *  * edit_mode       How to edit this slot (popup (default), inline)
 */
function _get_sympal_content_slot($name, $options = array())
{
    if (isset($options['content'])) {
        $content = $options['content'];
        unset($options['content']);
    } else {
        $content = sfSympalContext::getInstance()->getCurrentContent();
    }
    // mark this content record as having content slots
    $content->setEditableSlotsExistOnPage(true);
    // merge the default config for this slot into the given config
    $slotOptions = sfSympalConfig::get($content->Type->slug, 'content_slots', array());
    if (isset($slotOptions[$name])) {
        $options = array_merge($slotOptions[$name], $options);
    }
    // retrieve the slot
    if ($name instanceof sfSympalContentSlot) {
        $slot = $name;
        $name = $name->getName();
    } else {
        $slot = $content->getOrCreateSlot($name, $options);
        unset($options['default_value']);
    }
    $slot->setContentRenderedFor($content);
    /**
     * Either render the raw value or the editor for the slot
     */
    if (sfSympalContext::getInstance()->shouldLoadFrontendEditor()) {
        use_helper('SympalContentSlotEditor');
        return get_sympal_content_slot_editor($content, $slot, $options);
    } else {
        return $slot->render();
    }
}
コード例 #9
0
ファイル: index.php プロジェクト: albertobraschi/toad
 function comment_save(&$page)
 {
     // check if we need to save a comment
     if (!isset($_POST['comment'])) {
         return;
     }
     global $__FROG_CONN__;
     if ($page->comment_status != Comment::OPEN) {
         return;
     }
     $data = $_POST['comment'];
     if (is_null($data)) {
         return;
     }
     if (!isset($data['author_name']) or trim($data['author_name']) == '') {
         return;
     }
     if (!isset($data['author_email']) or trim($data['author_email']) == '') {
         return;
     }
     if (!isset($data['body']) or trim($data['body']) == '') {
         return;
     }
     use_helper('Kses');
     $allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
     // get the setting for comments moderations
     //$sql = 'SELECT value FROM '.TABLE_PREFIX.'setting WHERE name=\'auto_approve_comment\'';
     //$stmt = $__FROG_CONN__->prepare($sql);
     //$stmt->execute();
     //$auto_approve_comment = (int) $stmt->fetchColumn();
     $auto_approve_comment = 1;
     $sql = 'INSERT INTO ' . TABLE_PREFIX . 'comment (page_id, author_name, author_email, author_link, body, is_approved, created_on) VALUES (' . '\'' . $page->id . '\', ' . $__FROG_CONN__->quote(strip_tags($data['author_name'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_email'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_link'])) . ', ' . $__FROG_CONN__->quote(kses($data['body'], $allowed_tags)) . ', ' . $__FROG_CONN__->quote($auto_approve_comment) . ', ' . $__FROG_CONN__->quote(date('Y-m-d H:i:s')) . ')';
     $__FROG_CONN__->exec($sql);
     Observer::notify('comment_after_add');
 }
コード例 #10
0
 public function filterSympalContent(sfEvent $event, $content)
 {
     if (sfSympalConfig::get('sfSympalCommentsPlugin', 'installed') && sfSympalConfig::get('sfSympalCommentsPlugin', 'enabled') && sfSympalConfig::get($event['content']->getType()->getSlug(), 'enable_comments')) {
         use_helper('Comments');
         $content .= get_sympal_comments($event['content']);
     }
     return $content;
 }
 /**
  * @param string $help
  *
  * @return string
  */
 public function formatHelp($help)
 {
     if (!$help) {
         return '';
     }
     use_helper('Partial');
     return get_partial('help/link-modal', array('name' => 'jenkins/addBuild/parameter-description', 'title' => "Parameter", 'params' => array('help' => $help)));
 }
コード例 #12
0
/**
 * Returns an <img> tag for the activity image
 *
 * @param   ActivityImage $activityImage
 * @param   mixed[]       $options
 * @return  string
 */
function op_activity_image_tag($activityImage, $options = array())
{
    use_helper('sfImage');
    if ($activityImage->relatedExists('File')) {
        return op_image_tag_sf_image($activityImage->File, $options);
    } else {
        return op_image_tag($activityImage->uri, $options);
    }
}
コード例 #13
0
function button_to_modal_box_preview($name, $id_formulario, $informe)
{
    use_helper('Javascript');
    $js = "\n  function preview_informe()\n  {\n    Modalbox.show('" . url_for('informes/preview?id_informe=' . $informe->getPrimaryKey()) . "', {title: '" . __('Vista preliminar del informe') . "', width: 700});\n  }";
    $html = content_tag('script', $js, array('type' => 'text/javascript'));
    $html .= button_to_function($name, 'preview_informe();', array('class' => 'sf_action_show', 'submit' => $id_formulario));
    $html .= "\n";
    return $html;
}
コード例 #14
0
    /**
     * Returns the rich text editor as HTML.
     *
     * @return string Rich text editor HTML representation
     */
    public function toHTML()
    {
        $options = $this->options;
        // we need to know the id for things the rich text editor
        // in advance of building the tag
        $id = _get_option($options, 'id', $this->name);
        // use tinymce's gzipped js?
        $tinymce_file = _get_option($options, 'tinymce_gzip') ? '/tiny_mce_gzip.php' : '/tiny_mce.js';
        // tinymce installed?
        // $js_path = sfConfig::get('sf_rich_text_js_dir') ? '/'.sfConfig::get('sf_rich_text_js_dir').$tinymce_file : '/sf/tinymce/js'.$tinymce_file;
        $js_path = sfConfig::get('sf_rich_text_js_dir') ? '/' . sfConfig::get('sf_rich_text_js_dir') . $tinymce_file : '/sf/tinymce/js' . $tinymce_file;
        if (!is_readable(sfConfig::get('sf_web_dir') . $js_path)) {
            throw new sfConfigurationException('You must install TinyMCE to use this helper (see rich_text_js_dir settings).');
        }
        sfContext::getInstance()->getResponse()->addJavascript($js_path);
        use_helper('Javascript');
        $tinymce_options = '';
        $style_selector = '';
        // custom CSS file?
        if ($css_file = _get_option($options, 'css')) {
            $css_path = stylesheet_path($css_file);
            sfContext::getInstance()->getResponse()->addStylesheet($css_path);
            $css = file_get_contents(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $css_path);
            $styles = array();
            preg_match_all('#^/\\*\\s*user:\\s*(.+?)\\s*\\*/\\s*\\015?\\012\\s*\\.([^\\s]+)#Smi', $css, $matches, PREG_SET_ORDER);
            foreach ($matches as $match) {
                $styles[] = $match[1] . '=' . $match[2];
            }
            $tinymce_options .= '  content_css: "' . $css_path . '",' . "\n";
            $tinymce_options .= '  theme_advanced_styles: "' . implode(';', $styles) . '"' . "\n";
            $style_selector = 'styleselect,separator,';
        }
        $culture = sfContext::getInstance()->getUser()->getCulture();
        $tinymce_js = '
tinyMCE.init({
  mode: "exact",
  language: "' . strtolower(substr($culture, 0, 2)) . '",
  elements: "' . $id . '",
  plugins: "table,advimage,advlink,flash",
  theme: "advanced",
  theme_advanced_toolbar_location: "top",
  theme_advanced_toolbar_align: "left",
  theme_advanced_path_location: "bottom",
  theme_advanced_buttons1: "' . $style_selector . 'justifyleft,justifycenter,justifyright,justifyfull,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap",
  theme_advanced_buttons2: "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,image,flash,separator,cleanup,removeformat,separator,code",
  theme_advanced_buttons3: "tablecontrols",
  extended_valid_elements: "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
  relative_urls: false,
  debug: false
  ' . ($tinymce_options ? ',' . $tinymce_options : '') . '
  ' . (isset($options['tinymce_options']) ? ',' . $options['tinymce_options'] : '') . '
});';
        if (isset($options['tinymce_options'])) {
            unset($options['tinymce_options']);
        }
        return content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')) . content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => get_id_from_name($id, null)), _convert_options($options)));
    }
コード例 #15
0
ファイル: GlobalHelper.php プロジェクト: emacsattic/symfony
function link_to_login($name, $uri = null)
{
    use_helper('Javascript');
    if ($uri && sfContext::getInstance()->getUser()->isAuthenticated()) {
        return link_to($name, $uri);
    } else {
        return link_to_function($name, visual_effect('blind_down', 'login', array('duration' => 0.5)));
    }
}
コード例 #16
0
 /**
  * get the InlineGallery from current value
  */
 protected function getInlineObjectGalleryFromValue()
 {
     # why is use_helper not available ?
     require_once dirname(__FILE__) . '/../../../../../lib/vendor/symfony/lib/helper/HelperHelper.php';
     use_helper('InlineObject');
     $parser = get_inline_object_parser();
     $objects = $parser->parseTypes($this->getObject()->getValue());
     return $objects[1][0];
 }
コード例 #17
0
ファイル: CommentHelper.php プロジェクト: bshaffer/Symplist
function link_to_add_new_comment($name, $record, $comment = null)
{
    use_helper('Javascript');
    $params = array();
    $params['update'] = $comment && $comment->getId() ? 'add_new_comment_form_holder_' . $comment->getId() : 'add_new_comment_form_holder';
    $params['url'] = '@cscomments_comments_add';
    $comment_id = $comment ? $comment->getId() : null;
    $params['with'] = "'comment_id=" . $comment_id . "&model=" . get_class($record) . "&record_id=" . $record->getId() . "&return_uri=" . urlencode(sfContext::getInstance()->getRequest()->getUri()) . "'";
    return link_to_remote($name, $params);
}
コード例 #18
0
ファイル: opJsonApiHelper.php プロジェクト: te-koyama/openpne
function op_api_activity($activity)
{
    use_helper('opActivity');
    $viewMemberId = sfContext::getInstance()->getUser()->getMemberId();
    $member = $activity->getMember();
    $images = array();
    foreach ($activity->getImages() as $activityImage) {
        $images[] = array('small_size' => op_activity_image_uri($activityImage, array('size' => '48x48'), true), 'full_size' => op_activity_image_uri($activityImage, array(), true));
    }
    return array('id' => $activity->getId(), 'member' => op_api_member($member), 'body' => $activity->getBody(), 'body_html' => op_activity_linkification(nl2br(op_api_force_escape($activity->getBody()))), 'uri' => $activity->getUri(), 'source' => $activity->getSource(), 'source_uri' => $activity->getSourceUri(), 'image_uris' => $images, 'created_at' => date('r', strtotime($activity->getCreatedAt())));
}
コード例 #19
0
function has_helper($helper = null)
{
    if (is_null($helper)) {
        throw new sfException('Missing first argument from has_helper');
    } else {
        try {
            use_helper($helper);
        } catch (Exception $e) {
            return false;
        }
        return true;
    }
}
コード例 #20
0
ファイル: Url.class.php プロジェクト: pycmam/sfSmarty3Plugin
 public static function urlFor()
 {
     use_helper('Url');
     $args = func_get_arg(0);
     if (array_key_exists('url', $args)) {
         $absolute = false;
         if (array_key_exists('absolute', $args)) {
             $absolute = $args['absolute'];
         }
         return url_for($args['url'], $absolute);
     }
     throw new sfException('Invalid arguments');
 }
コード例 #21
0
ファイル: MarkdownHelper.php プロジェクト: bshaffer/Symplist
function markdown_preview_link($field)
{
    use_helper('JavascriptBase');
    use_stylesheet('/csDoctrineMarkdownPlugin/css/markdown.css');
    $submit = content_tag('a', 'Preview', array('href' => '#', 'onclick' => 'javascript:markdown_preview(this);return false'));
    $js = javascript_tag(sprintf(<<<EOF
  function markdown_preview (e) {
    var markdown_text = \$('form *[name=%s]').val();
    \$('#markdown_preview').load('%s', { 'markdown_value': markdown_text }, function() { \$(this).append("<a href='#' onclick='\$(\\"#markdown_preview\\").hide()'>hide</a>") } ).css('display', 'block');
  }
EOF
, $field, url_for('csMarkdown/preview?markdown_field=' . $field)));
    return $submit . $js;
}
コード例 #22
0
ファイル: opChatHelper.php プロジェクト: upsilon/opChatPlugin
function op_chat_get_sounds($absolute = false)
{
    use_helper('Asset');
    static $sounds;
    $result = array();
    if (!is_array($sounds)) {
        $sounds = array('in' => '/opChatPlugin/sounds/in.mp3', 'out' => '/opChatPlugin/sounds/out.mp3', 'notice' => '/opChatPlugin/sounds/notice.mp3');
        foreach ($sounds as $name => $sound) {
            if (file_exists(sfConfig::get('sf_web_dir') . $sound)) {
                $result[$name] = _compute_public_path($sound, sfConfig::get('sf_web_dir', ''), 'mp3', $absolute);
            }
        }
    }
    return empty($result) ? null : $result;
}
コード例 #23
0
ファイル: AnswerHelper.php プロジェクト: emacsattic/symfony
function link_to_report_answer($answer, $user)
{
    use_helper('Javascript');
    $text = '[' . __('report to moderator') . ']';
    if ($user->isAuthenticated()) {
        $has_already_reported_answer = ReportAnswerPeer::retrieveByPk($answer->getId(), $user->getSubscriberId());
        if ($has_already_reported_answer) {
            // already spam for this user
            return '[' . __('reported as spam') . ']';
        } else {
            return link_to_remote($text, array('url' => '@user_report_answer?id=' . $answer->getId(), 'update' => array('success' => 'report_answer_' . $answer->getId()), 'loading' => "Element.show('indicator')", 'complete' => "Element.hide('indicator');" . visual_effect('highlight', 'report_answer_' . $answer->getId())));
        }
    } else {
        return link_to_login($text);
    }
}
コード例 #24
0
ファイル: SeoHelper.php プロジェクト: bshaffer/Symplist
function ie6_update()
{
    use_helper('Javascript');
    echo "<!--[if lte IE 6]>";
    javascript_tag();
    echo <<<EOF
    /*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<script type=\\"text/javascript\\"   src=\\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\\"></"+"script>"); var __noconflict = true; } 
      var IE6UPDATE_OPTIONS = {
        icons_path: "http://static.ie6update.com/hosted/ie6update/images/"
      }
    </script>
    <script type="text/javascript" src="http://static.ie6update.com/hosted/ie6update/ie6update.js">
EOF;
    end_javascript_tag();
    echo "<![endif]-->";
}
コード例 #25
0
ファイル: ModalBoxHelper.php プロジェクト: sgrove/cothinker
/**
 * Enable to use Modalbox script : http://www.wildbit.com/labs/modalbox/
 *
 * *
 * @author Gerald Estadieu <*****@*****.**>
 * @since  15 Apr 2007
 *
 */
function m_link_to($name, $url, $html_options = array(), $modal_options = array())
{
    use_helper('Javascript');
    if (array_key_exists('title', $html_options)) {
        $modal_options = array_merge($modal_options, array('title' => 'this.title'));
    }
    $params_to_escape = sfConfig::get('app_params_to_escape_list');
    // escape strings for js
    foreach ($modal_options as $option => $value) {
        if (in_array($option, $params_to_escape)) {
            $modal_options[$option] = "'" . $value . "'";
        }
    }
    $js_options = _options_for_javascript($modal_options);
    $html_options['onclick'] = "Modalbox.show(this.href, " . $js_options . "); return false;";
    return link_to($name, $url, $html_options);
}
コード例 #26
0
function generate_path()
{
    $sf_context = sfContext::getInstance();
    $module = $sf_context->getModuleName();
    $action = $sf_context->getActionName();
    $forum = (bool) strstr($sf_context->getRequest()->getUri(), 'forums');
    if ($action == 'home') {
        return '';
    }
    $path = __('Context:') . ' ' . link_to(__('Home'), '@homepage');
    if ($forum) {
        use_helper('Forum');
        $path .= ' &gt; ' . f_link_to(__('Forum'), '?lang=' . $sf_context->getUser()->getCulture());
    } elseif ($module != 'documents') {
        $path .= ' &gt; ' . link_to(ucfirst(__($module)), "@default_index?module={$module}");
    }
    return '<nav ' . ($forum ? '' : 'itemprop="breadcrumb" ') . 'id="path">' . $path . '</nav>';
}
コード例 #27
0
    /**
     * @param  string $name        The element name
     * @param  string $value       The date displayed in this widget
     * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
     * @param  array  $errors      An array of errors for the field
     *
     * @return string An HTML tag string
     *
     * @see sfWidgetForm
     */
    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        $id = $this->generateId($name);
        $image = '';
        if (false !== $this->getOption('image')) {
            $image = sprintf(', buttonImage: %s, buttonImageOnly: true', $this->getOption('image'));
        }
        use_helper('Date');
        if ($value != '') {
            $value = format_date($value, 'dd/MM/yyyy');
        }
        return parent::render($name, $value, $attributes, $errors) . sprintf(<<<EOF
<script type="text/javascript">
    \$("#%s").datepicker(\$.datepicker.regional['%s'],%s);
</script>
EOF
, $id, $this->getOption('culture'), $this->getOption('config'));
    }
コード例 #28
0
function select_periodo_meses($nombre, $valor = '', $duracion_periodo_meses = 1, $include_blank = true)
{
    use_helper('DateForm');
    $opciones = array();
    if ($duracion_periodo_meses == 1) {
        $value = select_month_tag($nombre, $valor, array('control_name' => $nombre));
    } else {
        $lista_periodos = array('2' => 'bimestre', '3' => 'trimestre', '4' => 'cuatrimestre', '6' => 'semestre');
        $periodo = $lista_periodos[$duracion_periodo_meses];
        $lista_posiciones = array('1' => __('primer'), '2' => __('segundo'), '3' => __('tercer'), '4' => __('cuarto'), '5' => __('quinto'), '6' => __('sexto'));
        $cuantos = floor(12 / $duracion_periodo_meses);
        $opciones = array();
        for ($i = 1; $i <= $cuantos; $i++) {
            $opciones[$i] = __('%1% %2%', array('%1%' => $lista_posiciones[$i], '%2%' => $periodo));
        }
        $value = select_tag($nombre, options_for_select($opciones, $valor, array('include_blank' => $include_blank)), array('control_name' => $nombre));
    }
    return $value;
}
コード例 #29
0
/**
 * Get Sympal content slot value
 *
 * @param Content $content  The Content instance
 * @param string $name The name of the slot
 * @param string $type The type of slot
 * @param string $renderFunction The function/callable used to render the value of slots which are columns
 * @param array  $options Array of options for this slot
 * @return void
 */
function get_sympal_content_slot($content, $name, $type = null, $renderFunction = null, $options = array())
{
    if ($type === null) {
        $type = 'Text';
    }
    $slot = null;
    if ($name instanceof sfSympalContentSlot) {
        $slot = $name;
        $name = $name->getName();
    } else {
        $slot = $content->getOrCreateSlot($name, $type, $renderFunction, $options);
    }
    $slot->setContentRenderedFor($content);
    if (sfSympalContext::getInstance()->shouldLoadFrontendEditor()) {
        use_helper('SympalContentSlotEditor');
        return get_sympal_content_slot_editor($content, $slot, $options);
    } else {
        return $slot->render();
    }
}
コード例 #30
0
function m_link_to($name, $url, $html_options = array(), $modal_options = array())
{
    use_helper('Javascript');
    if (is_string($html_options)) {
        $html_options = array('title' => __($html_options));
    } elseif (!is_array($html_options)) {
        $html_options = array();
    }
    // modalbox specific options
    if (array_key_exists('title', $html_options)) {
        $modal_options = array_merge($modal_options, array('title' => 'this.title'));
    }
    if (!array_key_exists('remote', $modal_options)) {
        $modal_options['remote'] = 'this.href';
    }
    $js_options = _options_for_javascript($modal_options);
    if (!c2cTools::mobileVersion()) {
        $html_options['onclick'] = "\$.modalbox.show({$js_options}); return false;";
    }
    return link_to($name, $url, $html_options);
}