public static function instanceExists($instance) { if (in_array($instance, array('www', 'dev', 'dev2', 'demo', 'admin', 'manager'))) { return true; } return erLhcoreClassModelInstance::getCount(array('filter' => array('address' => $instance))) > 0; }
$tpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Please choose at least one valid module!'))); } } $pages = new lhPaginator(); $pages->items_total = erLhcoreClassModelInstanceInvoice::getCount(array('filter' => array('instance_id' => $instance->id))); $pages->translationContext = 'instance/billing'; $pages->serverURL = erLhcoreClassDesign::baseurl('instance/billing'); $pages->setItemsPerPage(20); $pages->paginate(); $tpl->set('pages', $pages); $items = array(); if ($pages->items_total > 0) { $items = erLhcoreClassModelInstanceInvoice::getList(array('filter' => array('instance_id' => $instance->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page)); } $tpl->set('items', $items); if ($instance->is_reseller) { $pagesInstances = new lhPaginator(); $pagesInstances->items_total = erLhcoreClassModelInstance::getCount(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id))); $pagesInstances->translationContext = 'instance/billing'; $pagesInstances->serverURL = erLhcoreClassDesign::baseurl('instance/billinginstance'); $pagesInstances->setItemsPerPage(20); $pagesInstances->paginate(); $tpl->set('pagesInstance', $pagesInstances); $items = array(); if ($pagesInstances->items_total > 0) { $items = erLhcoreClassModelInstance::getList(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id), 'offset' => $pagesInstances->low, 'limit' => $pagesInstances->items_per_page)); } $tpl->set('itemsInstance', $items); } $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Billing')));
<?php try { $tpl = erLhcoreClassTemplate::getInstance('lhinstance/list.tpl.php'); $pages = new lhPaginator(); $pages->items_total = erLhcoreClassModelInstance::getCount(); $pages->translationContext = 'abstract/list'; $pages->serverURL = erLhcoreClassDesign::baseurl('instance/list'); $pages->setItemsPerPage(20); $pages->paginate(); $tpl->set('pages', $pages); $items = array(); if ($pages->items_total > 0) { $items = erLhcoreClassModelInstance::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC')); } $tpl->set('items', $items); $tpl->set('pages', $pages); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instances'))); } catch (Exception $e) { print_r($e); }
$instanceAssign->saveThis(); } } } /** * Unasign instance */ if (is_numeric($Params['user_parameters_unordered']['unasign']) && $Params['user_parameters_unordered']['unasign'] > 0) { $instanceAssign = erLhcoreClassModelInstance::fetch($Params['user_parameters_unordered']['unasign']); $instanceAssign->reseller_id = 0; $instanceAssign->saveThis(); } /** * Child instances * */ $pages = new lhPaginator(); $pages->items_total = erLhcoreClassModelInstance::getCount(array('filter' => array('reseller_id' => $Instance->id))); $pages->translationContext = 'abstract/list'; $pages->serverURL = erLhcoreClassDesign::baseurl('instance/assign') . '/' . $Instance->id; $pages->setItemsPerPage(20); $pages->paginate(); $tpl->set('pages', $pages); $items = array(); if ($pages->items_total > 0) { $items = erLhcoreClassModelInstance::getList(array('filter' => array('reseller_id' => $Instance->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC')); } $tpl->set('items', $items); $tpl->set('pages', $pages); $tpl->set('instance', $Instance); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('instance/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instances')), array('url' => erLhcoreClassDesign::baseurl('instance/edit') . '/' . $Instance->id, 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instance') . ' - ' . $Instance->address), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Child instances')));