$page_href .= "&search_username="******"&search_status=" . $search_status; } if ($search_date) { $page_href .= "&search_date=" . $search_date; } $pg = new pagination(); $pg->Items($total); $pg->limit($pnum); $pg->target($page_href); $pg->currentPage($page); $pg->nextT = ' <a href="[+link+]">' . $langTxt['next'] . '</a> '; $pg->prevT = ' <a href="[+link+]">' . $langTxt['prev'] . '</a> '; $pager = $pg->getOutput(); //Данные заказов $data_query = $modx->db->query("SELECT shk.id, shk.short_txt, shk.price, shk.currency, shk.note, shk.status, shk.userid, DATE_FORMAT(shk.date,'%d.%m.%Y %k:%i') AS date, DATE_FORMAT(shk.sentdate,'%d.%m.%Y %k:%i') AS sentdate " . $data_q . $orderby_q); //$data_query = $modx->db->select("id, short_txt, price, currency, note, status, userid, DATE_FORMAT(date,'%d.%m.%Y %k:%i') AS date, DATE_FORMAT(sentdate,'%d.%m.%Y %k:%i') AS sentdate", $shkm->mod_table, "", "id DESC", "$start,$pnum"); //Данные пользователей $userData_query = $modx->db->select("DISTINCT wu.id, wu.username", $dbprefix . "web_users wu, {$shkm->mod_table} shk", "wu.id = shk.userid", "", ""); $users_id_list = "0"; while ($userData = mysql_fetch_row($userData_query)) { $userName[$userData[0]] = $userData[1]; $users_id_list .= "," . $userData[0]; } //Число заказов пользователя $users_all_purchase = array(); $user_purchase_query = $modx->db->select("webuser, setting_value", $shkm->mod_user_table, "setting_name = 'count_purchase' AND webuser in({$users_id_list})", "", ""); while ($user_purchase = mysql_fetch_row($user_purchase_query)) { $users_all_purchase[$user_purchase[0]] = strpos($user_purchase[1], '/') !== false ? explode('/', $user_purchase[1]) : array($user_purchase[1], 0);
$output_list = ''; $status_list = $upconf['action'] == 'archorders' ? '4,5' : '1,2,3,6'; $total = $modx->db->getValue($modx->db->select("COUNT(*)", $mod_table, "userid = '{$userId}' AND status in({$status_list})")); //pagination $pages = ''; $qs_page = !empty($_GET[$upconf['id_prefix'] . 'page']) && is_numeric($_GET[$upconf['id_prefix'] . 'page']) ? $modx->db->escape($_GET[$upconf['id_prefix'] . 'page']) : 1; $qs_start = !empty($_GET[$upconf['id_prefix'] . 'start']) && !is_array($_GET[$upconf['id_prefix'] . 'start']) ? $_GET[$upconf['id_prefix'] . 'start'] : $qs_page * $upconf['display'] - $upconf['display']; $p = new pagination(); $p->nextT = ' <a href="[+link+]">' . $langTxt['next'] . '</a> '; $p->prevT = ' <a href="[+link+]">' . $langTxt['prev'] . '</a> '; $p->numberT = ' <a href="[+link+]">[+num+]</a> '; $p->currentT = ' <b>[+num+]</b> '; //' <a class="current" href="[+link+]">[+num+]</a> '; $p->prevI = ''; $p->Items($total); $p->limit($upconf['display']); $p->target($upconf['thisPage'] . $upconf['qs'] . $upconf['id_prefix'] . "act=purchase&" . $upconf['id_prefix'] . "sub=" . $upconf['action']); $p->currentPage($qs_page); $p->parameterName($upconf['id_prefix'] . 'page'); $pages .= $p->getOutput(); $totalPages = ceil($orders_total_count / $upconf['display']); //orders $output_list = $shk_uprofile->getOrderList($userId, $list_chunk, $qs_start, $status_list); $shk_uprofile->phx->placeholders = array(); $shk_uprofile->setPlaceholders(array('notempty' => $total > 0 ? 'true' : '', 'title' => $title, 'list' => $output_list, 'pages' => $pages, 'totalPages' => $totalPages)); $output .= $shk_uprofile->phx->Parse($chunk[0] . '[+list+]' . $chunk[2]); $output = $shk_uprofile->cleanPHx($output); } break; } return $output;
return; } $output = $ctlView->renderRows($products, $cv_config['tpl']); $pagination = ''; if ($cv_config['paginate'] && !$cv_config['randomize'] && $cv_config['display'] > 0) { //pagination require_once MODX_BASE_PATH . "assets/snippets/catalogView/classes/pagination.class.php"; $p = new pagination(); $p->nextT = $langTxt['next']; //' <a href="[+link+]">'.$langTxt['next'].'</a> '; $p->prevT = $langTxt['prev']; //' <a href="[+link+]">'.$langTxt['prev'].'</a> '; $p->numberT = ' <a href="[+link+]" class="' . $cv_config['pageClass'] . '">[+num+]</a> '; $p->currentT = ' <b class="' . $cv_config['currentPageClass'] . '">[+num+]</b> '; $p->prevI = ''; $p->Items($total); $p->limit($ctlView->config['display']); $p->target($cv_config['thisPageUrl'] . $pagesQueryString); $p->currentPage($qs_page); $p->parameterName($cv_config['id_prefix'] . 'page'); $p->changeClass($cv_config['pageParentClass']); $pagination .= $p->getOutput(); $totalPages = ceil($total / $qs_display); $ctlView->setMODxPlaceholders(array("pages" => $pagination, "totalPages" => $totalPages)); } $ctlView->setMODxPlaceholders(array("sortBy" => $qs_sortBy, "sortDir" => $qs_sortDir, "qs_start" => $qs_start, "total" => $total, "currentPage" => $qs_page, "display" => $qs_display, "sortDirOther" => $sortDirOther, "filter" => $qs_filter, "pagesQueryString" => $pagesQueryString, "thisPageUrl" => $cv_config['thisPageUrl'])); if ($cv_config['toPlaceholder']) { $ctlView->setMODxPlaceholders(array($cv_config['toPlaceholder'] => $output)); $output = ''; } }
function showTestimonial() { $x = 0; $data = get_option('testimonials_manager'); $testimonialboxcount = count($data['data']); switch ($data['dorder']) { case 'random': shuffle($data['data']); break; case 'desc': $data['data'] = array_reverse($data['data']); ksort($data['data']); break; default: } echo <<<EOF <style> .clearfloat { clear: both; } </style> EOF; $p = new pagination(); $p->items($testimonialboxcount); $p->limit($data['items']); if (empty($_GET['pg'])) { $page = 1; } else { $page = $_GET['pg']; } $p->currentPage($page); $p->target(get_permalink()); $result = $p->getOutput(); // print_r($data); if ($testimonialboxcount > $data['items']) { $testimonialboxcount = $data['items']; // now to make the array smaller $newarray = array_slice($data['data'], ($page - 1) * $data['items'], $data['items']); $data['data'] = $newarray; $testimonialboxcount = count($newarray); } if ($testimonialboxcount == 0) { $result .= '<div class="testimonial" style="text-align:center;">'; $result .= '<strong>There are no testimonial yet</strong>'; $result .= '</div>'; } else { while ($x < $testimonialboxcount) { $url = $data['data'][$x]['url']; if (substr($url, 0, 7) != 'http://') { $url = 'http://' . $url; } $result .= '<div class="testimonial">'; if ($data['data'][$x]['avatar']) { if ($data['data'][$x]['avatar'] == "gravatar") { $result .= get_avatar($data['data'][$x]['email'], $size = $data['imagex']); } else { $result .= '<img src="' . $data['data'][$x]['own_avatar'] . '" class="avatar" alt="avatar" width="' . $data['imagex'] . '" height="' . $data['imagey'] . '" />'; } } $result .= stripslashes(nl2br($data['data'][$x]['text'])); $result .= '<cite>' . stripslashes($data['data'][$x]['name']); if ($data['data'][$x]['title']) { $result .= ', ' . stripslashes($data['data'][$x]['title']); } if ($data['data'][$x]['company_name']) { $result .= '<em>' . stripslashes($data['data'][$x]['company_name']) . '</em>'; } $result .= '</cite>'; if ($data['data'][$x]['url']) { $result .= '<a href="' . stripslashes($url) . '">'; } if ($data['data'][$x]['company']) { $result .= stripslashes($data['data'][$x]['company']); } if ($data['data'][$x]['url']) { $result .= '</a>'; } $result .= '<div class="clearfloat"></div></div>'; $x++; } } /* $s= <<<EOF <style> .copyyy,.copyyy a { font-size: 10px !important; font-family; veranda !important; color: #666666 !important; } </style> EOF; * */ $result .= $p->getOutput(); $result .= '<div class="testimonial" style="background: transparent; border:none; margin:0 0 20px 0; text-align:right;size:10px">Powered by the <a href="http://www.profitplugs.com/testimonials-manager-wordpress/" title="Testimonial Manager">Testimonial Manager Plugin for Wordpress.</a></div>'; return $result; }