本文整理汇总了PHP中Link::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::count方法的具体用法?PHP Link::count怎么用?PHP Link::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: salaries_prepare_head
/**
* Returns an array with the tabs for the "salaries" section
* It loads tabs from modules looking for the entity salaries
*
* @param Paiement $object Current salaries object
* @return array Tabs for the salaries section
*/
function salaries_prepare_head($object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/compta/salaries/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT . '/compta/salaries/document.php?id=' . $object->id;
$head[$h][1] = $langs->trans('Documents');
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/compta/salaries/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
return $head;
}
示例2: contact_prepare_head
/**
* Prepare array with list of tabs
*
* @param Contact $object Object related to tabs
* @return array Array of tabs to show
*/
function contact_prepare_head(Contact $object)
{
global $db, $langs, $conf, $user;
$tab = 0;
$head = array();
$head[$tab][0] = DOL_URL_ROOT . '/contact/card.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Card");
$head[$tab][2] = 'card';
$tab++;
if (!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_CONTACT_ACTIVE)) {
$langs->load("ldap");
$head[$tab][0] = DOL_URL_ROOT . '/contact/ldap.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("LDAPCard");
$head[$tab][2] = 'ldap';
$tab++;
}
$head[$tab][0] = DOL_URL_ROOT . '/contact/perso.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("PersonalInformations");
$head[$tab][2] = 'perso';
$tab++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'contact');
// Notes
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
$head[$tab][0] = DOL_URL_ROOT . '/contact/note.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Note");
if ($nbNote > 0) {
$head[$tab][1] .= ' <span class="badge">' . $nbNote . '</span>';
}
$head[$tab][2] = 'note';
$tab++;
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->societe->dir_output . "/contact/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$tab][0] = DOL_URL_ROOT . '/contact/document.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Documents");
if ($nbFiles + $nbLinks > 0) {
$head[$tab][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$tab][2] = 'documents';
$tab++;
// Info
$head[$tab][0] = DOL_URL_ROOT . '/contact/info.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Info");
$head[$tab][2] = 'info';
$tab++;
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'contact', 'remove');
return $head;
}
示例3: bank_prepare_head
/**
* Prepare array with list of tabs
*
* @param Account $object Object related to tabs
* @return array Array of tabs to show
*/
function bank_prepare_head(Account $object)
{
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("AccountCard");
$head[$h][2] = 'bankname';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/account.php?id=" . $object->id;
$head[$h][1] = $langs->trans("Transactions");
$head[$h][2] = 'journal';
$h++;
// if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
// {
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/treso.php?account=" . $object->id;
$head[$h][1] = $langs->trans("PlannedTransactions");
$head[$h][2] = 'cash';
$h++;
// }
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/annuel.php?account=" . $object->id;
$head[$h][1] = $langs->trans("IOMonthlyReporting");
$head[$h][2] = 'annual';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/graph.php?account=" . $object->id;
$head[$h][1] = $langs->trans("Graph");
$head[$h][2] = 'graph';
$h++;
if ($object->courant != 2) {
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/releve.php?account=" . $object->id;
$head[$h][1] = $langs->trans("AccountStatements");
$head[$h][2] = 'statement';
$h++;
}
// Attached files
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id;
$head[$h][1] = $langs->trans("Documents");
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'document';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove');
return $head;
}
示例4: contract_prepare_head
/**
* Prepare array with list of tabs
*
* @param Contrat $object Object related to tabs
* @return array Array of tabs to show
*/
function contract_prepare_head(Contrat $object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/contrat/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("ContractCard");
$head[$h][2] = 'card';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
$head[$h][0] = DOL_URL_ROOT . '/contrat/contact.php?id=' . $object->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = 0;
if (!empty($object->note_private)) {
$nbNote++;
}
if (!empty($object->note_public)) {
$nbNote++;
}
$head[$h][0] = DOL_URL_ROOT . '/contrat/note.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Notes");
if ($nbNote > 0) {
$head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
}
$head[$h][2] = 'note';
$h++;
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT . '/contrat/document.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Documents");
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/contrat/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract', 'remove');
return $head;
}
示例5: actionIndex
/**
* 首页
*
*/
public function actionIndex()
{
parent::_acl('link_index');
$model = new Link();
$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例6: count
static function count($status = '', $force = false)
{
global $db, $globals;
$my_id = SitesMgr::my_id();
if (!$status) {
return Link::count('published', $force) + Link::count('queued', $force) + Link::count('discard', $force) + Link::count('abuse', $force) + Link::count('autodiscard', $force);
}
$count = get_count("{$my_id}.{$status}");
if ($count === false || $force) {
$count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}'");
set_count("{$my_id}.{$status}", $count);
}
return $count;
}
示例7: count
static function count($status = '', $cat = '', $force = false)
{
global $db;
if (!$status) {
return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
}
$count = get_count("{$status}.{$cat}");
if ($count === false || $force) {
if ($cat) {
$cond = " and link_category in ({$cat}) ";
}
$count = $db->get_var("select count(*) from links where link_status = '{$status}' {$cond}");
set_count("{$status}.{$cat}", $count);
}
return $count;
}
示例8: do_master
function do_master($size)
{
global $globals, $db;
echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
echo '<sitemap>' . "\n";
echo '<loc>http://' . get_server_name() . $globals['base_url'] . 'sitemap.php?statics</loc>' . "\n";
echo '</sitemap>' . "\n";
$count = (int) Link::count('published');
$indexes = ceil($count / $size);
for ($i = 0; $i < $indexes; $i++) {
echo '<sitemap>' . "\n";
echo '<loc>http://' . get_server_name() . $globals['base_url'] . 'sitemap.php?page=' . $i . '</loc>' . "\n";
echo '</sitemap>' . "\n";
}
echo '</sitemapindex>' . "\n";
}
示例9: run
public function run()
{
$model = new Link();
//条件
$criteria = new CDbCriteria();
$title = trim(Yii::app()->request->getParam('title'));
$title && $criteria->addSearchCondition('title', $title);
$criteria->order = 't.id ASC';
$count = $model->count($criteria);
//分页
$pages = new CPagination($count);
$pages->pageSize = 10;
$pages->applyLimit($criteria);
//查询
$result = $model->findAll($criteria);
$this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
}
示例10: index
/**
* @before _secure
*/
public function index()
{
$this->seo(array("title" => "Dashboard"));
$view = $this->getActionView();
$d = 1;
$publishers = User::all(["org_id = ?" => $this->org->_id, "type = ?" => "publisher"], ["_id"]);
$in = array_keys($publishers);
$start = RM::get("start", date('Y-m-d', strtotime('-4 day')));
$end = RM::get("end", date('Y-m-d', strtotime('now')));
$dq = ['start' => date('Y-m-d', strtotime("-365 day")), 'end' => $end];
$pubPerf = (object) Performance::total($dq, $publishers);
$advPerf = (object) Performance::total($dq, $this->org->users('advertiser', 'users'), ['revenue']);
$topusers = $this->widgets();
if (array_key_exists("widgets", $this->org->meta)) {
$d = in_array("top10ads", $this->org->meta["widgets"]) + in_array("top10pubs", $this->org->meta["widgets"]);
}
$view->set("start", $start)->set("end", $end)->set("d", 12 / $d)->set("topusers", $topusers)->set("links", \Link::count(['user_id' => ['$in' => $in]]))->set("platforms", \Platform::count(['user_id' => ['$in' => $in]]))->set("performance", Performance::calProfit($pubPerf, $advPerf));
}
示例11: count
static function count($status='', $cat='', $force = false) {
global $db;
if (!$status) return Link::count('published', $cat, $force) +
Link::count('queued', $cat, $force) +
Link::count('discard', $cat, $force) +
Link::count('abuse', $cat, $force) +
Link::count('autodiscard', $cat, $force);
$count = get_count("$status.$cat");
if ($count === false || $force) {
if ($cat) $cond = " and link_category in ($cat) ";
$count = $db->get_var("select count(*) from links where link_status = '$status' $cond");
set_count("$status.$cat", $count);
}
return $count;
}
示例12: count
static function count($status = '', $cat = '', $force = false)
{
global $db, $globals;
$my_id = SitesMgr::my_id();
if (!$status) {
return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
}
$count = get_count("{$my_id}.{$status}.{$cat}");
if ($count === false || $force) {
if (!empty($cat)) {
$extra = "and category in ({$cat})";
} else {
$extra = '';
}
$count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}' {$extra}");
set_count("{$my_id}.{$status}.{$cat}", $count);
}
return $count;
}
示例13: actionLink
/**
* 链接
*/
public function actionLink()
{
parent::_acl('link_index');
$model = new Link();
$criteria = new CDbCriteria();
$condition = '1';
$siteName = trim($this->_gets->getParam('siteName'));
$siteName && ($condition .= ' AND site_name LIKE \'%' . $siteName . '%\'');
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = XUtils::buildCondition($_GET, array('site_name'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('link_index', array('datalist' => $result, 'pagebar' => $pages));
}
示例14: actionIndex
/**
* 首页
*/
public function actionIndex()
{
$model = new Link();
$criteria = new CDbCriteria();
$condition = '1';
$siteName = trim($this->_request->getParam('title'));
$siteName && ($condition .= ' AND title LIKE \'%' . $siteName . '%\'');
$criteria->condition = $condition;
//$criteria->params = '';
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = $this->buildCondition($_GET, array('title'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例15: facture_prepare_head
/**
* Initialize the array of tabs for customer invoice
*
* @param Facture $object Invoice object
* @return array Array of head tabs
*/
function facture_prepare_head($object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/compta/facture.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'compta';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/contact.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
$head[$h][2] = 'contact';
$h++;
}
if (!empty($conf->global->MAIN_USE_PREVIEW_TABS)) {
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/apercu.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Preview');
$head[$h][2] = 'preview';
$h++;
}
//if ($fac->mode_reglement_code == 'PRE')
if (!empty($conf->prelevement->enabled)) {
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/prelevement.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('StandingOrders');
$head[$h][2] = 'standingorders';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = 0;
if (!empty($object->note_private)) {
$nbNote++;
}
if (!empty($object->note_public)) {
$nbNote++;
}
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/note.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) {
$head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
}
$head[$h][2] = 'note';
$h++;
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/document.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Documents');
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/info.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'remove');
return $head;
}