Exemple #1
0
 public function slider_html($panels, $dimensions, $slider_name, $type = 'images')
 {
     // initialise values
     // panel count
     $panel_count = count($panels);
     // get the full width of the panel
     $panel_full = $this->panel_full($dimensions);
     // the number of complete visible panels (the width of the row in panels)
     $full_panels_visible = floor($dimensions['width'] / ($panel_full + $dimensions['spacer']));
     // the number of panel set that make up the whole row (the plus one is because the the first panel set contains the panel that is just showing)
     // panel set is the set of panels which are wholly visible (doesn't include any portions of panels showing as a hint)
     // NB don't take one off if the panels exactly fit into the width and no hint is left
     // also set the initial panels visible, again effected by whether a hint panel is shown
     if (0 == $dimensions['width'] % $panel_full) {
         $panel_sets = ceil($panel_count / $full_panels_visible);
         $initial_panels_visible = $full_panels_visible;
         $adjuster = 0;
     } else {
         $panel_sets = ceil(($panel_count - 1) / $full_panels_visible);
         $initial_panels_visible = $full_panels_visible + 1;
         $adjuster = 1;
         // gets rid of extra panel
     }
     // width of all the panels in pixels
     $panel_width = $panel_count * $panel_full + $panel_count * $dimensions['spacer'];
     // width for the dead panel that marks that there are no more to slide
     $dead_panel_width = $dimensions['width'] - $full_panels_visible * ($panel_full + $dimensions['spacer']);
     // add this to the full panel width
     $panel_width += $dead_panel_width;
     // slide distance derived
     $slide_distance = $full_panels_visible * ($panel_full + $dimensions['spacer']);
     // counter
     $ocount = "<span class='counter'>";
     $ocount .= "<span id='" . $slider_name . "_count'>1</span> of " . $panel_sets;
     $ocount .= "</span>";
     // direction buttons
     $buttons = '';
     if ($panel_width > $dimensions['width']) {
         $buttons .= "<div id='" . $slider_name . "_slbs' class='slbs'>\n";
         $buttons .= "<span class='sprite slld slb'></span>";
         //$buttons.="<span class='sprite slr slb' onclick='slider_move(\"".$slider_name."\",\"right\",".$slide_distance.",1)'>go left one panel</span>";
         $buttons .= "<span class='sprite slr slb' onclick='slide_to(\"" . $slider_name . "\",1)'>go left one panel</span>";
         $buttons .= "</div>";
     } else {
         $buttons .= "<div id='" . $slider_name . "_slbs' class='slbs'>";
         $buttons .= "<span class='sprite slld slb'></span>";
         $buttons .= "<span class='sprite slrd slb'></span>";
         $buttons .= "</div>";
     }
     // the slider
     if ('images' == $type ? $schema_type = 'ImageGallery' : ($schema_type = 'ItemList')) {
     }
     $html = "<div id='" . $slider_name . "' class='slider slw' itemscope itemtype='http://schema.org/" . $schema_type . "'>";
     // sequence buttons
     $seq = "<div id='" . $slider_name . "_sqbs' class='sqbs'>";
     $seq_count = 1;
     // open the slider panel
     $html .= "<div class='viewer_row slh slw'>";
     $html .= "<div class='viewer_window slh slw'>";
     $html .= "<div class='list_panel slh' style='width:" . $panel_width . "px;'>";
     // build the set of panels up into an array of widths
     for ($x = 0; $x < $panel_sets; $x++) {
         // set the panel count for this width
         if (0 == $x ? $pc = $initial_panels_visible : ($pc = $full_panels_visible)) {
         }
         // tip
         $tip = '';
         // iterate over the panel count extracting panels and adding them to the js array
         for ($y = 0; $y < $pc; $y++) {
             // get the right panel
             if (0 == $x ? $element = $y : ($element = $x * $full_panels_visible + $adjuster + $y)) {
             }
             // make the panel
             if (isset($panels[$element])) {
                 $html .= $this->slider_panel($panels[$element], $dimensions, $slider_name, $x);
                 if ($dimensions['spacer'] > 0) {
                     $html .= item_spacer($dimensions['spacer']);
                 }
             }
             //
             if (isset($panels[$element]['tool_tip']) ? $tip .= $panels[$element]['tool_tip'] . "; " : ($tip .= '')) {
             }
         }
         // create the sequence button
         if (strlen($tip) > 0) {
             $tip = substr($tip, 0, -2);
         }
         if (0 == $x ? $sel_class = 'sqb_sel' : ($sel_class = '')) {
         }
         $seq .= "<span id='" . $slider_name . "_sqb" . $x . "' class='sqb " . $sel_class . "' title='" . $tip . "' ";
         $seq .= "onclick='slide_to(\"" . $slider_name . "\"," . $x . ")'>move to " . ($x + 1) . "</span>";
     }
     // dead panel, let the user know there are no more
     /*if ($panel_width>$dimensions['width'])
       {*/
     $html .= "<span class='dead_panel slh' style='width:" . $dead_panel_width . "px;'>";
     $html .= "";
     $html .= "</span>";
     /*}*/
     // close the slider panel
     $html .= "</div>";
     $html .= "</div>";
     $html .= "</div>";
     // close whole thing
     $seq .= "</div>";
     $html .= "</div>";
     // hard code the slide distance in javascript for the functions to use
     $html .= "<span class='hide' id='" . $slider_name . "_slide_distance'>" . $slide_distance . "</span>";
     $html .= "<span class='hide' id='" . $slider_name . "_tps'>0</span>";
     $html .= "<span class='hide' id='" . $slider_name . "_count_of'>" . $panel_sets . "</span>";
     // build the return array
     $return_array = array('slider' => $html, 'buttons' => $buttons, 'sequence' => $seq, 'count' => $ocount, 'close' => "<div id='close_slider' class='sprite'>X</div>");
     return $return_array;
 }
Exemple #2
0
 if ($stream[$x]['a'] == 2 && $stream[$x]['c'] > 1) {
     // this special case re-words for better English
     $strstring .= " ... updated " . $stream[$x]['nt'] . " <a href='" . str_replace($this->config->item('full_domain'), "", $stream[$x]['nl']) . "'>" . $stream[$x]['nn'] . "</a> " . $count . " times";
 } else {
     $strstring .= " ... " . str_replace('%_COUNT', $count, $actions[$stream[$x]['a']][$plur]) . " " . $stream[$x]['nt'] . " <a href='" . str_replace($this->config->item('full_domain'), "", $stream[$x]['nl']) . "'>" . $stream[$x]['nn'] . "</a>";
 }
 $strstring .= "</span>";
 // build the image output panel
 $images = '';
 if (isset($stream[$x]['il'])) {
     $images = "<div class='strimages'>";
     $imgs = $stream[$x]['il'];
     for ($y = 0; $y < count($imgs); $y++) {
         $images .= "<img class='rounded2' src='" . $imgs[$y] . "' height='30' width='30'/>";
         if ($y % 9 != 8) {
             $images .= item_spacer(5, 30);
         }
     }
     $images .= "</div>";
 }
 // sort out the date stamp
 $date = date("D dS M y", $stream[$x]['t']);
 // viewed or not
 if ($user['user_id'] == $node['id']) {
     if (isset($stream[$x]['v']) && 0 == $stream[$x]['v']) {
         $class = 'strpanel notify';
         $txclass = 'strdate strdate_notify';
         $stream[$x]['v'] = 1;
         $save_trigger = 1;
         // only save the stream if there were actual notifications to view
     } else {
Exemple #3
0
 $strstring = "";
 if ($stream[$x]['a'] == 2 && $stream[$x]['c'] > 1) {
     // this special case re-words for better English
     $strstring .= "<a href='/" . $stream[$x]['al'] . "'>" . $stream[$x]['an'] . "</a> updated " . $stream[$x]['nt'] . " <a href='/" . $stream[$x]['nl'] . "'>" . $stream[$x]['nn'] . "</a> " . $count . " times";
 } else {
     $strstring .= "<a href='/" . $stream[$x]['al'] . "'>" . $stream[$x]['an'] . "</a> " . $actions[$stream[$x]['a']] . " " . $stream[$x]['nt'] . " <a href='/" . $stream[$x]['nl'] . "'>" . $stream[$x]['nn'] . "</a>";
 }
 // build the image output panel
 $images = '';
 if (isset($stream[$x]['il'])) {
     $images = "<div class='strimages'>";
     $imgs = $stream[$x]['il'];
     for ($y = 0; $y < count($imgs); $y++) {
         $images .= "<img class='rounded2' src='" . $imgs[$y] . "' height='59' width='59'/>";
         if ($y % 9 != 8) {
             $images .= item_spacer(9, 59);
         }
     }
     $images .= "</div>";
 }
 // sort out the date stamp
 $date = date("d-m-Y H:i:s", $stream[$x]['t']);
 // viewed or not
 if ($user['user_id'] == $node['id']) {
     if (isset($stream[$x]['v']) && 0 == $stream[$x]['v']) {
         $class = 'strpanel notify';
         $txclass = 'strdate_notify';
         $stream[$x]['v'] = 1;
         $save_trigger = 1;
         // only save the stream if there were actual notifications to view
     } else {