本文整理汇总了PHP中Package::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::getByID方法的具体用法?PHP Package::getByID怎么用?PHP Package::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::getByID方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module
public function module($module = null, $task = null) {
Loader::model('dashboard/homepage');
$dh = new DashboardHomepageView();
$mod = $dh->getByHandle($module);
if ($mod->pkgID > 0) {
$pkg = Package::getByID($mod->pkgID);
$class = Loader::dashboardModuleController($mod->dbhModule, $pkg);
} else {
$class = Loader::dashboardModuleController($mod->dbhModule);
}
$args = func_get_args();
array_shift($args);
array_shift($args); // no that's not a misprint
if (method_exists($class, $task)) {
try {
$resp = call_user_func_array(array($class, $task), $args);
if ($resp) {
$this->set('message', $resp);
}
} catch(Exception $e) {
$this->set('error', $e);
}
}
print $this->view();
}
示例2: inspect_package
public function inspect_package($pkgID = 0) {
if ($pkgID > 0) {
$pkg = Package::getByID($pkgID);
}
if (isset($pkg) && ($pkg instanceof Package)) {
$this->set('pkg', $pkg);
} else {
$this->redirect('/dashboard/extend/install');
}
}
示例3: output
public function output($dbh) {
ob_start();
if ($dbh->pkgID > 0) {
$pkg = Package::getByID($dbh->pkgID);
Loader::dashboardModule($dbh->dbhModule, $pkg);
} else {
Loader::dashboardModule($dbh->dbhModule);
}
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例4: remove
public function remove($ptID, $token = '')
{
$v = Loader::helper('validation/error');
try {
$valt = Loader::helper('validation/token');
if (!$valt->validate('remove', $token)) {
throw new Exception($valt->getErrorMessage());
}
$pl = PageTheme::getByID($ptID);
if (!is_object($pl)) {
throw new Exception(t('Invalid theme.'));
}
/*
if ($pl->getPackageID() > 0) {
throw new Exception('You may not uninstall a packaged theme.');
}
*/
$localUninstall = true;
if ($pl->getPackageID() > 0) {
// then we check to see if this is the only theme in that package. If so, we uninstall the package too
$pkg = Package::getByID($pl->getPackageID());
$items = $pkg->getPackageItems();
if (count($items) == 1) {
$_pl = $items[0];
if ($_pl instanceof PageTheme && $_pl->getThemeID() == $ptID) {
$pkg->uninstall();
$localUninstall = false;
}
}
}
if ($localUninstall) {
$pl->uninstall();
}
$this->set('message', t('Theme uninstalled.'));
} catch (Exception $e) {
$v->add($e);
$this->set('error', $v);
}
$this->view();
}
示例5: install
/**
* @return Package
*/
public function install()
{
PackageList::refreshCache();
$db = Loader::db();
$dh = Loader::helper('date');
$v = array($this->getPackageName(), $this->getPackageDescription(), $this->getPackageVersion(), $this->getPackageHandle(), 1, $dh->getSystemDateTime());
$db->query("insert into Packages (pkgName, pkgDescription, pkgVersion, pkgHandle, pkgIsInstalled, pkgDateInstalled) values (?, ?, ?, ?, ?, ?)", $v);
$pkg = Package::getByID($db->Insert_ID());
Package::installDB($pkg->getPackagePath() . '/' . FILENAME_PACKAGE_DB);
$env = Environment::get();
$env->clearOverrideCache();
return $pkg;
}
示例6: t
<tr>
<td colspan="4">
<?php
echo t('No pages found.');
?>
</td>
</tr>
<?php
} else {
?>
<?php
foreach ($generated as $p) {
$cp = new Permissions($p);
if ($p->getPackageID() > 0) {
$package = Package::getByID($p->getPackageID());
if (is_object($package)) {
$packageHandle = $package->getPackageHandle();
$packageName = $package->getPackageName();
}
} else {
$packageName = t('None');
}
?>
<tr>
<td style="width: 30%"><a href="<?php
echo DIR_REL;
?>
/<?php
echo DISPATCHER_FILENAME;
?>
示例7: getPackageObject
public function getPackageObject()
{
return Package::getByID($this->getPackageID());
}
示例8: refresh
public function refresh() {
// takes a generated collection and refreshes it - updates its path, it's cDateModified
// it's name, it's permissions
if (!$this->isGeneratedCollection()) {
return false;
}
$pkg = Package::getByID($this->getPackageID());
$currentPath = $this->getCollectionPath();
$pathToFile = SinglePage::getPathToNode($currentPath, $pkg);
$pxml = SinglePage::obtainPermissionsXML($currentPath, $pkg);
$txt = Loader::helper('text');
$data = array();
$data['cName'] = $txt->unhandle($this->getCollectionHandle());
$data['cFilename'] = $pathToFile;
$this->update($data);
if ($pxml) {
$this->assignPermissionSet($pxml); // pass it an array
}
}
示例9: render
//.........这里部分代码省略.........
}
} else {
if (is_string($view)) {
// if we're passing a view but our render override is not null, that means that we're passing
// a new view from within a controller. If that's the case, then we DON'T override the viewPath, we want to keep it
// In order to enable editable 404 pages, other editable pages that we render without actually visiting
if (defined('DB_DATABASE') && $view == '/page_not_found') {
$pp = Page::getByPath($view);
if (!$pp->isError()) {
$this->c = $pp;
}
}
$viewPath = $view;
if ($this->controller->getRenderOverride() != '' && $this->getCollectionObject() != null) {
// we are INSIDE a collection renderring a view. Which means we want to keep the viewPath that of the collection
$this->viewPath = $this->getCollectionObject()->getCollectionPath();
}
// we're just passing something like "/login" or whatever. This will typically just be
// internal Concrete stuff, but we also prepare for potentially having something in DIR_FILES_CONTENT (ie: the webroot)
if (file_exists(DIR_FILES_CONTENT . "/{$view}/" . FILENAME_COLLECTION_VIEW)) {
$content = DIR_FILES_CONTENT . "/{$view}/" . FILENAME_COLLECTION_VIEW;
} else {
if (file_exists(DIR_FILES_CONTENT . "/{$view}.php")) {
$content = DIR_FILES_CONTENT . "/{$view}.php";
} else {
if (file_exists(DIR_FILES_CONTENT_REQUIRED . "/{$view}/" . FILENAME_COLLECTION_VIEW)) {
$content = DIR_FILES_CONTENT_REQUIRED . "/{$view}/" . FILENAME_COLLECTION_VIEW;
} else {
if (file_exists(DIR_FILES_CONTENT_REQUIRED . "/{$view}.php")) {
$content = DIR_FILES_CONTENT_REQUIRED . "/{$view}.php";
} else {
if ($this->getCollectionObject() != null && $this->getCollectionObject()->isGeneratedCollection() && $this->getCollectionObject()->getPackageID() > 0) {
//This is a single_page associated with a package, so check the package views as well
$pagePkgPath = Package::getByID($this->getCollectionObject()->getPackageID())->getPackagePath();
if (file_exists($pagePkgPath . "/single_pages/{$view}/" . FILENAME_COLLECTION_VIEW)) {
$content = $pagePkgPath . "/single_pages/{$view}/" . FILENAME_COLLECTION_VIEW;
} else {
if (file_exists($pagePkgPath . "/single_pages/{$view}.php")) {
$content = $pagePkgPath . "/single_pages/{$view}.php";
}
}
}
}
}
}
}
$wrapTemplateInTheme = true;
$themeFilename = $view . '.php';
}
}
if (is_object($this->c)) {
$c = $this->c;
if (defined('DB_DATABASE') && ($view == '/page_not_found' || $view == '/login')) {
$view = $c;
$req = Request::get();
$req->setCurrentPage($c);
$_pageBlocks = $view->getBlocks();
$_pageBlocksGlobal = $view->getGlobalBlocks();
$_pageBlocks = array_merge($_pageBlocks, $_pageBlocksGlobal);
}
}
if (is_array($_pageBlocks)) {
foreach ($_pageBlocks as $b1) {
$b1p = new Permissions($b1);
if ($b1p->canRead()) {
$btc = $b1->getInstance();
示例10: render
//.........这里部分代码省略.........
} else if (is_string($view)) {
// if we're passing a view but our render override is not null, that means that we're passing
// a new view from within a controller. If that's the case, then we DON'T override the viewPath, we want to keep it
// In order to enable editable 404 pages, other editable pages that we render without actually visiting
if (defined('DB_DATABASE') && $view == '/page_not_found') {
$pp = Page::getByPath($view);
if (!$pp->isError()) {
$this->c = $pp;
}
}
$viewPath = $view;
if ($this->controller->getRenderOverride() != '' && $this->getCollectionObject() != null) {
// we are INSIDE a collection renderring a view. Which means we want to keep the viewPath that of the collection
$this->viewPath = $this->getCollectionObject()->getCollectionPath();
}
// we're just passing something like "/login" or whatever. This will typically just be
// internal Concrete stuff, but we also prepare for potentially having something in DIR_FILES_CONTENT (ie: the webroot)
if (file_exists(DIR_FILES_CONTENT . "/{$view}/" . FILENAME_COLLECTION_VIEW)) {
$content = DIR_FILES_CONTENT . "/{$view}/" . FILENAME_COLLECTION_VIEW;
} else if (file_exists(DIR_FILES_CONTENT . "/{$view}.php")) {
$content = DIR_FILES_CONTENT . "/{$view}.php";
} else if (file_exists(DIR_FILES_CONTENT_REQUIRED . "/{$view}/" . FILENAME_COLLECTION_VIEW)) {
$content = DIR_FILES_CONTENT_REQUIRED . "/{$view}/" . FILENAME_COLLECTION_VIEW;
} else if (file_exists(DIR_FILES_CONTENT_REQUIRED . "/{$view}.php")) {
$content = DIR_FILES_CONTENT_REQUIRED . "/{$view}.php";
} else if ($this->getCollectionObject() != null && $this->getCollectionObject()->isGeneratedCollection() && $this->getCollectionObject()->getPackageID() > 0) {
//This is a single_page associated with a package, so check the package views as well
$pagePkgPath = Package::getByID($this->getCollectionObject()->getPackageID())->getPackagePath();
if (file_exists($pagePkgPath . "/single_pages/{$view}/" . FILENAME_COLLECTION_VIEW)) {
$content = $pagePkgPath . "/single_pages/{$view}/" . FILENAME_COLLECTION_VIEW;
} else if (file_exists($pagePkgPath . "/single_pages/{$view}.php")) {
$content = $pagePkgPath . "/single_pages/{$view}.php";
}
}
$wrapTemplateInTheme = true;
$themeFilename = $view . '.php';
}
if (is_object($this->c)) {
$c = $this->c;
if (defined('DB_DATABASE') && $view == '/page_not_found') {
$view = $c;
$req = Request::get();
$req->setCurrentPage($c);
}
}
// Determine which outer item/theme to load
// obtain theme information for this collection
if (isset($this->themeOverride)) {
$theme = $this->themeOverride;
} else if ($this->controller->theme != false) {
$theme = $this->controller->theme;
} else if (($tmpTheme = $this->getThemeFromPath($viewPath)) != false) {
$theme = $tmpTheme;
} else if (is_object($this->c) && ($tmpTheme = $this->c->getCollectionThemeObject()) != false) {
$theme = $tmpTheme;
} else {
$theme = FILENAME_COLLECTION_DEFAULT_THEME;
示例11: refresh
/**
* refreshes the BlockType's database schema throws an Exception if error
* @return void
*/
public function refresh() {
if ($this->getPackageID() > 0) {
$pkg = Package::getByID($this->getPackageID());
$resp = BlockType::installBlockTypeFromPackage($this->getBlockTypeHandle(), $pkg, $this->getBlockTypeID());
if ($resp != '') {
throw new Exception($resp);
}
} else {
$resp = BlockType::installBlockType($this->getBlockTypeHandle(), $this->getBlockTypeID());
if ($resp != '') {
throw new Exception($resp);
}
}
}
示例12: exportList
public static function exportList($x)
{
$nconfig = $x->addChild('config');
$db = Loader::db();
$r = $db->Execute("select cfKey, cfValue, pkgID from Config where uID = 0 and cfKey not in ('SITE','SITE_APP_VERSION','SEEN_INTRODUCTION')");
while ($row = $r->FetchRow()) {
$option = $nconfig->addChild($row['cfKey'], $row['cfValue']);
if ($row['pkgID'] > 0) {
$pkg = Package::getByID($row['pkgID']);
if (is_object($pkg)) {
$option->addAttribute('package', $pkg->getPackageHandle());
}
}
}
}
示例13: package_installed
public function package_installed($pkgID = 0)
{
$this->set('message', t('The package has been installed.'));
$this->set('installedPKG', Package::getByID($pkgID));
}