本文整理汇总了PHP中Loader::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::model方法的具体用法?PHP Loader::model怎么用?PHP Loader::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
public function form()
{
Loader::model('page_list');
$pl = new PageList();
$lastParent = '';
$selected = $_REQUEST['akID'][$this->getAttributeKey()->getAttributeKeyID()]['value'];
if (!$selected && $this->getAttributeValueID() > 0) {
$selected = $this->getValue()->cID;
}
$selectString = "<select id='{$this->field('value')}' name='{$this->field('value')}' ><option value=''>--</option>";
$pl->filterByCollectionTypeHandle('city');
$pages = $pl->get();
uasort($pages, function ($a, $b) {
$ap = $a->getCollectionParentID();
$bp = $b->getCollectionParentID();
return $ap === $bp ? 0 : strcmp(Page::getByID($ap)->getCollectionName(), Page::getByID($bp)->getCollectionName());
});
foreach ($pages as $page) {
$parent = Page::getByID($page->getCollectionParentID())->getCollectionName();
if ($lastParent != $parent) {
if ($lastParent !== '') {
$selectString .= '</optgroup>';
}
$selectString .= "<optgroup label='{$parent}'>";
$lastParent = $parent;
}
$selectedAttributeVal = '';
if ($selected === $page->cID) {
$selectedAttributeVal = ' selected="selected"';
}
$selectString .= "<option value=\"{$page->getCollectionID()}\"" . $selectedAttributeVal . ">{$page->getCollectionName()}</option>";
}
$selectString .= '</select>';
echo $selectString;
}
示例2: __construct
public function __construct()
{
$this->contentid = isset($_GET['contentid']) && trim(urldecode($_GET['contentid'])) ? trim(urldecode($_GET['contentid'])) : $this->_show_msg(L('illegal_parameters'));
$this->contentid = safe_replace($this->contentid);
$this->db = Loader::model('digg_model');
$this->db_log = Loader::model('digg_log_model');
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->db = Loader::model('admin_login_log_model');
$this->admin_username = cookie('admin_username');
// 管理员COOKIE
}
示例4: init
/**
* 推送选择界面
*/
public function init()
{
if (isset($_POST['dosubmit'])) {
$c = Loader::model('content_model');
$c->set_model($_POST['modelid']);
$info = array();
$ids = explode('|', $_POST['id']);
if (is_array($ids)) {
foreach ($ids as $id) {
$info[$id] = $c->get_content($_POST['catid'], $id);
}
}
$_GET['add_action'] = isset($_GET['add_action']) ? $_GET['add_action'] : $_GET['act'];
$this->push->{$_GET}['add_action']($info, $_POST);
showmessage(L('success'), '', '', 'push');
} else {
Loader::helper('template:global');
if (method_exists($this->push, $_GET['act'])) {
$html = $this->push->{$_GET['act']}(array('modelid' => $_GET['modelid'], 'catid' => $_GET['catid']));
$tpl = isset($_GET['tpl']) ? 'push_to_category' : 'push_list';
include $this->view($tpl);
} else {
showmessage('CLASS METHOD NO EXISTS!', 'blank');
}
}
}
示例5: run_import_item
public function run_import_item()
{
Loader::model($_REQUEST['importType'], 'problog_importer');
$location = $_REQUEST['importLocation'];
$ctID = $_REQUEST['selectedPageType'];
$path = DIR_BASE . File::getRelativePathFromID($_REQUEST['importXml']);
$xmlObject = simplexml_load_file($path, 'SimpleXMLElement');
$i = $_REQUEST['i'];
foreach ($xmlObject->channel->item as $item_object) {
$t++;
if ($t == $i) {
$method = ucfirst($_REQUEST['importType']) . 'Item';
$item = new $method($item_object);
//var_dump($item);exit;
$page = new CreateBlogPost($item, $location, $ctID);
//print json_encode($child);
if ($page) {
print json_encode(array('success' => 1));
} else {
print json_encode(array('error' => t('There was a problem with your import.')));
}
}
}
exit;
}
示例6: view
public function view()
{
$uh = Loader::helper('concrete/urls');
$bt = BlockType::getByHandle('switch_language');
Loader::model('section', 'multilingual');
$ml = MultilingualSection::getList();
$c = Page::getCurrentPage();
$al = MultilingualSection::getBySectionOfSite($c);
$languages = array();
$locale = ACTIVE_LOCALE;
if (is_object($al)) {
$locale = $al->getLanguage();
}
foreach ($ml as $m) {
$languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
}
$this->set('languages', $languages);
$this->set('languageSections', $ml);
$this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
if (is_object($al)) {
$this->set('activeLanguage', $al->getCollectionID());
}
$pkg = Package::getByHandle('multilingual');
$mdl = Loader::helper('default_language', 'multilingual');
$this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
$this->set('cID', $c->getCollectionID());
}
示例7: getFile
function getFile($fID) {
Loader::model('file');
$mf = new File();
$file_obj = $mf->getByID($fID);
$fileversion_obj = $file_obj->getVersion();
$bf = new LibraryFileBlockController;
$ftype = FileTypeList::getType($fileversion_obj->getExtension());
$this->generictype = strtolower($ftype->getGenericTypeText($ftype->getGenericType()));
$this->filename = $fileversion_obj->getFileName();
$this->type = $fileversion_obj->getType();
$this->url = $fileversion_obj->getURL();
$this->filepath = $fileversion_obj->getPath();
$this->relpath = $fileversion_obj->getRelativePath();
$this->origfilename = $fileversion_obj->getRelativePath();
$this->filesize = $fileversion_obj->getFullSize();
$len = strlen(REL_DIR_FILES_UPLOADED);
$fh = Loader::helper('concrete/file');
$bf->bID = $fileversion_obj->getFileID();
$bf->generictype = $this->generictype;
$bf->type = $this->type;
$bf->url = $this->url;
$bf->filepath = $this->filepath;
$bf->relpath = $this->relpath;
$bf->filename = substr($this->relpath, $len); // for backwards compatibility this must include the prefixes
$bf->filesize = $this->filesize;
return $bf;
}
示例8: view
public function view()
{
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
Loader::model("page_statistics");
Loader::model("user_statistics");
$timeStr = '';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$timeStr = '%x ' . t('at') . ' %I:%M %p';
} else {
$timeStr = '%x ' . t('at') . ' %l:%M %p';
}
if (is_object($ui)) {
$this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
$this->set('uName', $ui->getUserName());
$this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
$llu = UserStatistics::getLastLoggedInUser();
if ($llu->getUserID() == $u->getUserID()) {
$this->set('lastLoginSite', t('Your login is the most recent.'));
} else {
$this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
}
Loader::block('form');
}
$this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
$this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
}
示例9: activate_files
public function activate_files($ptID)
{
try {
Loader::model("collection_types");
$pt = PageTheme::getByID($ptID);
$txt = Loader::helper('text');
if (!is_array($this->post('pageTypes'))) {
throw new Exception(t("You must specify at least one template to make into a page type."));
}
$pkg = false;
$pkgHandle = $pt->getPackageHandle();
if ($pkgHandle) {
$pkg = Package::getByHandle($pkgHandle);
}
foreach ($this->post('pageTypes') as $ptHandle) {
$data['ctName'] = $txt->unhandle($ptHandle);
$data['ctHandle'] = $ptHandle;
$ct = CollectionType::add($data, $pkg);
}
$this->set('message', t('Files in the theme were activated successfully.'));
} catch (Exception $e) {
$this->set('error', $e);
}
$this->view($ptID);
}
示例10: prepare_remote_upgrade
public function prepare_remote_upgrade($remoteMPID = 0){
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
Loader::model('marketplace_remote_item');
$mri = MarketplaceRemoteItem::getByID($remoteMPID);
if (!is_object($mri)) {
$this->set('error', array(t('Invalid marketplace item ID.')));
return;
}
$local = Package::getbyHandle($mri->getHandle());
if (!is_object($local) || $local->isPackageInstalled() == false) {
$this->set('error', array(Package::E_PACKAGE_NOT_FOUND));
return;
}
$r = $mri->downloadUpdate();
if ($r != false) {
if (!is_array($r)) {
$this->set('error', array($r));
} else {
$errors = Package::mapError($r);
$this->set('error', $errors);
}
} else {
$this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle());
}
}
}
示例11: run
public function run() {
$db = Loader::db();
Loader::model('single_page');
Cache::disableLocalCache();
// we backup the custom styles table
$this->backupCustomStylesTables();
// upgrade blocks that differ between versions
$this->updateBlocks();
// Migrate data from the custom styles tables to the new approach
$this->migrateCustomStyleData();
$this->setupSiteSearchIndexing();
$this->installTaskPermissions();
$this->updateDashboard();
// add the dark chocolate theme
$pt = PageTheme::getByHandle('dark_chocolate');
if (!is_object($pt)) {
$chocolate = PageTheme::add('dark_chocolate');
}
Cache::enableLocalCache();
}
示例12: do_add
public function do_add()
{
extract($this->getHelperObjects());
Loader::model('file_set');
if (!$validation_token->validate("file_sets_add")) {
$this->set('error', array($validation_token->getErrorMessage()));
return;
}
if (!trim($this->post('file_set_name'))) {
$this->set('error', array(t('Please Enter a Name')));
return;
}
$setName = trim($this->post('file_set_name'));
if (preg_match('/[<>;{}?"`]/i', $setName)) {
$this->set('error', array(t('File Set Name cannot contain the characters: %s', Loader::helper('text')->entities('<>;{}?"`'))));
return;
}
//print('<pre>');print_r(get_included_files());print('</pre>');
$u = new User();
$file_set = new FileSet();
//AS: Adodb Active record is complaining a ?/value array mismatch unless
//we explicatly set the primary key ID field to null
$file_set->fsID = null;
$file_set->fsName = $setName;
$file_set->fsType = FileSet::TYPE_PUBLIC;
$file_set->uID = $u->getUserID();
$file_set->fsOverrideGlobalPermissions = $this->post('fsOverrideGlobalPermissions') == 1 ? 1 : 0;
$file_set->save();
$this->redirect('/dashboard/files/sets', 'file_set_added');
}
示例13: __construct
public function __construct()
{
Loader::model('system/captcha/library');
Loader::model('system/captcha/controller');
$captcha = SystemCaptchaLibrary::getActive();
$this->controller = $captcha->getController();
}
示例14: run
function run()
{
Loader::model('cobble', 'cobble');
$cbl = new Cobble();
$cbl->refresh();
return "Cobble Tables were Refreshed";
}
示例15: run
public function run()
{
$db = Loader::db();
$cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user'));
if ($cnt < 1) {
$g3 = Group::getByID(ADMIN_GROUP_ID);
$tip = TaskPermission::addTask('delete_user', t('Delete Users'), false);
if (is_object($g3)) {
$tip->addAccess($g3);
}
}
Loader::model('single_page');
$sp = Page::getByPath('/dashboard/settings/multilingual');
if ($sp->isError()) {
$d1a = SinglePage::add('/dashboard/settings/multilingual');
$d1a->update(array('cName' => t('Multilingual Setup')));
}
$sp = Page::getByPath('/dashboard/composer');
if ($sp->isError()) {
$d2 = SinglePage::add('/dashboard/composer');
$d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.')));
}
$sp = Page::getByPath('/dashboard/composer/write');
if ($sp->isError()) {
$d3 = SinglePage::add('/dashboard/composer/write');
}
$sp = Page::getByPath('/dashboard/composer/drafts');
if ($sp->isError()) {
$d4 = SinglePage::add('/dashboard/composer/drafts');
}
$sp = Page::getByPath('/dashboard/pages/types/composer');
if ($sp->isError()) {
$d5 = SinglePage::add('/dashboard/pages/types/composer');
}
}