Example #1
0
      <?php 
            if ($tabText != $text) {
                ?>
        <?php 
                $updateActiveJs .= "document.getElementById('button_tabs_" . str_replace(' ', '', strtolower($tabText)) . "').setAttribute('class', 'inactive');";
                ?>
      <?php 
            }
            ?>
    <?php 
        }
        ?>


    <?php 
        echo ls_link_to_remote($text, array('url' => $ary['url'], 'update' => $update, 'method' => 'get', 'loading' => "document.getElementById('indicator').style.display = 'block';" . $updateActiveJs, 'complete' => "document.getElementById('indicator').style.display = 'none';"), $options);
        ?>
  <?php 
    } else {
        ?>
    <span id="button_tabs_<?php 
        echo str_replace(' ', '', strtolower($text));
        ?>
" class="<?php 
        echo in_array(sfContext::getInstance()->getActionName(), $ary['actions']) ? 'active' : 'inactive';
        ?>
">
    <?php 
        echo link_to($text, $ary['url'], $options);
        ?>
    
Example #2
0
<?php

use_helper('LsJavascript');
?>

<?php 
echo ls_link_to_remote('&laquo; See all relationships', array('url' => $entity->getInternalUrl('relationships'), 'update' => 'relationship_tabs_content', 'method' => 'get', 'loading' => "document.getElementById('indicator').style.display = 'block';", 'complete' => "document.getElementById('indicator').style.display = 'none';"), array('return' => true, 'href' => '#relationships', 'class' => 'text_big'));
?>

<br />
<br />

<?php 
include_partial('global/section', array('title' => 'Lobbying', 'pager' => $lobbying_pager));
?>

<div class="padded">
<?php 
foreach ($lobbying_pager->execute() as $id => $ary) {
    ?>
  <?php 
    include_partial('entity/entitywithrelationships', array('related_entity' => $ary['entity'], 'relationships' => $ary['rels'], 'profiled_entity' => $entity));
}
?>
</div>
Example #3
0
function pager_meta_sample($pager, $path, $sort = null)
{
    if (!$pager->getExecuted()) {
        $pager->execute();
    }
    if ($pager->getNumResults() == 0) {
        return "Nothing found.";
    }
    $ret = $pager->getFirstIndice() . "-" . $pager->getLastIndice() . " of " . $pager->getNumResults();
    if ($pager->getLastIndice() < $pager->getNumResults()) {
        $ret .= " :: ";
        //sometimes pager links need to use AJAX
        if ($pager->isAjax()) {
            $options = array('update' => $pager->getAjaxUpdateId(), 'url' => $path, 'method' => 'get');
            //if a loading graphic id is given, use it
            if ($indicatorId = $pager->getAjaxIndicatorId()) {
                $options['loading'] = "document.getElementById('" . $indicatorId . "').style.display = 'block';";
                $options['complete'] = "document.getElementById('" . $indicatorId . "').style.display = 'none';";
            }
            //hrefs are used to make the links RESTful
            if ($hash = $pager->getAjaxHash()) {
                $htmlOptions = array('return' => true, 'href' => $href = '#' . $hash);
            } else {
                $htmlOptions = array('return' => true);
            }
            use_helper('LsJavascript');
            $link = ls_link_to_remote('see all', $options, $htmlOptions);
        } else {
            $link = link_to('see all', $path);
        }
        $ret .= $link;
    }
    if ($sort && count($sort['values'])) {
        $ret .= ' :: sort by ';
        $sortLinks = array();
        $request = sfContext::getInstance()->getRequest();
        $holder = $request->getParameterHolder();
        $holder = clone $holder;
        $current = $request->getParameter('sort', $sort['default']);
        foreach ($sort['values'] as $name => $value) {
            if ($value != $current) {
                $holder->set('sort', $value);
                $params = array_filter($holder->getAll(), array('LsLogic', 'isNotNull'));
                $path = $request->getPathInfo();
                $queryString = http_build_query($params);
                $sortLinks[] = link_to($name, $path, array('query_string' => $queryString));
            }
        }
        $ret .= implode(' ', $sortLinks);
    }
    return $ret;
}