本文整理汇总了PHP中commonModel类的典型用法代码示例。如果您正苦于以下问题:PHP commonModel类的具体用法?PHP commonModel怎么用?PHP commonModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了commonModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxUpload
/**
* AJAX: the api to recive the file posted through ajax.
*
* @param string $uid
* @access public
* @return array
*/
public function ajaxUpload($uid)
{
if (RUN_MODE == 'front' and !commonModel::isAvailable('forum')) {
exit;
}
if (!$this->loadModel('file')->canUpload()) {
$this->send(array('error' => 1, 'message' => $this->lang->file->uploadForbidden));
}
$file = $this->file->getUpload('imgFile');
$file = $file[0];
if ($file) {
if (!$this->file->checkSavePath()) {
$this->send(array('error' => 1, 'message' => $this->lang->file->errorUnwritable));
}
if (!in_array(strtolower($file['extension']), $this->config->file->imageExtensions)) {
$this->send(array('error' => 1, 'message' => $this->lang->fail));
}
move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname']);
if (in_array(strtolower($file['extension']), $this->config->file->imageExtensions) !== false) {
$this->file->compressImage($this->file->savePath . $file['pathname']);
$imageSize = $this->file->getImageSize($this->file->savePath . $file['pathname']);
$file['width'] = $imageSize['width'];
$file['height'] = $imageSize['height'];
}
$url = $this->file->webPath . $file['pathname'];
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = helper::now();
$file['editor'] = 1;
unset($file['tmpname']);
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$_SESSION['album'][$uid][] = $this->dao->lastInsertID();
die(json_encode(array('error' => 0, 'url' => $url)));
}
}
示例2: index
/**
* The index page of admin panel, print the sites.
*
* @access public
* @return void
*/
public function index()
{
$this->app->loadConfig('product');
$messages = new stdclass();
if (commonModel::isAvailable('forum')) {
$this->view->threads = $this->loadModel('thread')->getThreads();
$this->view->threadReply = $this->loadModel('reply')->getReplies();
}
if (commonModel::isAvailable('message')) {
$messages->comment = $this->loadModel('message')->getMessages('comment');
$messages->message = $this->loadModel('message')->getMessages('message');
$messages->reply = $this->loadModel('message')->getMessages('reply');
}
if (commonModel::isAvailable('order')) {
$this->view->orders = $this->loadModel('order')->getOrders();
}
if (commonModel::isAvailable('contribution')) {
$this->view->contributions = $this->loadModel('article')->getContributions();
}
$this->view->articleCategories = $this->loadModel('tree')->getOptionMenu('article', 0, $removeRoot = true);
$this->view->todayReport = $this->loadModel('stat')->getTodayReport();
$this->view->yestodayReport = $this->loadModel('stat')->getYestodayReport();
$this->view->ignoreUpgrade = isset($this->config->global->ignoreUpgrade) and $this->config->global->ignoreUpgrade;
$this->view->checkLocation = $this->loadModel('user')->checkAllowedLocation();
$this->view->currencySymbol = $this->config->product->currencySymbol;
$this->view->messages = $messages;
$this->display();
}
示例3: createModuleMenu
public function createModuleMenu($method)
{
if (!isset($this->lang->my->{$method}->menu)) {
return false;
}
$string = "<nav id='menu'><ul class='nav'>\n";
/* Get menus of current module and current method. */
$moduleMenus = $this->lang->my->{$method}->menu;
$currentMethod = $this->app->getMethodName();
/* Cycling to print every menus of current module. */
foreach ($moduleMenus as $methodName => $methodMenu) {
/* Split the methodMenu to label, module, method, vars. */
list($label, $module, $method, $vars) = explode('|', $methodMenu);
$class = '';
if ($method == $currentMethod) {
$class = "class='active'";
}
$hasPriv = commonModel::hasPriv($module, $method);
if ($module == 'my' and $method == 'order') {
$hasPriv = commonModel::hasPriv('order', 'browse');
}
if ($module == 'my' and $method == 'contract') {
$hasPriv = commonModel::hasPriv('contract', 'browse');
}
if ($hasPriv) {
$string .= "<li {$class}>" . html::a(helper::createLink($module, $method, $vars), $label) . "</li>\n";
}
}
$string .= "</ul></nav>\n";
return $string;
}
示例4: sitemapXML
/**
* Output sitemap.xml.
*
* @access public
* @return void
*/
public function sitemapXML()
{
$this->loadModel('tree');
$this->loadModel('article');
$this->loadModel('product');
$this->loadModel('forum');
$this->loadModel('thread');
$bookAlias = $this->dao->select('id, alias')->from(TABLE_BOOK)->where('type')->eq('book')->fetchPairs('id', 'alias');
$nodes = $this->dao->select('id, title, type, path, alias, editedDate, addedDate')->from(TABLE_BOOK)->fetchAll();
$this->loadModel('book');
foreach ($nodes as $node) {
$bookID = $this->book->extractBookID($node->path);
$node->book = $bookAlias[$bookID];
}
$articles = $this->article->getList('article', $this->tree->getFamily(0, 'article'), 'id_desc');
$pages = $this->dao->select('id, title, alias')->from(TABLE_ARTICLE)->where('type')->eq('page')->andWhere('status')->eq('normal')->fetchAll('id');
$blogs = $this->article->getList('blog', $this->tree->getFamily(0, 'blog'), 'id_desc');
$products = $this->product->getList($this->tree->getFamily(0), 'id_desc');
$board = $this->tree->getFamily(0);
$threads = $this->dao->select('id, editedDate')->from(TABLE_THREAD)->beginIf($board)->where('board')->in($board)->orderBy('id desc')->fetchPairs();
$this->view->systemURL = commonModel::getSysURL();
$this->view->books = $nodes;
$this->view->articles = $articles;
$this->view->blogs = $blogs;
$this->view->products = $products;
$this->view->threads = $threads;
$this->view->pages = $pages;
$this->display();
}
示例5: admin
/**
* Admin all blocks.
*
* @param int $index
* @access public
* @return void
*/
public function admin($index = 0)
{
$title = $index == 0 ? $this->lang->block->createBlock : $this->lang->block->editBlock;
$entries = $this->dao->select('*')->from(TABLE_ENTRY)->where('block')->ne('')->orWhere('buildin')->eq(1)->fetchAll('id');
if (!$index) {
$index = $this->block->getLastKey('sys') + 1;
}
$allEntries[''] = '';
foreach ($entries as $id => $entry) {
if (!commonModel::hasAppPriv($entry->code)) {
continue;
}
$allEntries[$entry->code] = $entry->name;
}
//$allEntries['rss'] = 'RSS';
$allEntries['html'] = 'HTML';
$allEntries['allEntries'] = $this->lang->block->allEntries;
$allEntries['dynamic'] = $this->lang->block->dynamic;
$hiddenBlocks = $this->block->getHiddenBlocks();
foreach ($hiddenBlocks as $block) {
$allEntries['hiddenBlock' . $block->id] = $block->title;
}
$this->view->block = $this->block->getBlock($index);
$this->view->entries = $entries;
$this->view->allEntries = $allEntries;
$this->view->index = $index;
$this->view->title = $title;
$this->display();
}
示例6: getAvailableBlocks
/**
* Get block list.
*
* @access public
* @return string
*/
public function getAvailableBlocks()
{
foreach ($this->lang->block->availableBlocks as $key => $block) {
if (!commonModel::hasPriv($key, 'browse')) {
unset($this->lang->block->availableBlocks->{$key});
}
}
return json_encode($this->lang->block->availableBlocks);
}
示例7: update
/**
* Update a product.
*
* @param int $productID
* @access public
* @return void
*/
public function update($productID)
{
$oldProduct = $this->getByID($productID);
$product = fixer::input('post')->add('editedBy', $this->app->user->account)->add('editedDate', helper::now())->get();
$this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()->batchCheck($this->config->product->require->edit, 'notempty')->where('id')->eq($productID)->exec();
if (dao::isError()) {
return false;
}
return commonModel::createChanges($oldProduct, $product);
}
示例8: getAvailableBlocks
/**
* Get block list.
*
* @access public
* @return string
*/
public function getAvailableBlocks()
{
foreach ($this->lang->block->availableBlocks as $key => $block) {
$module = $key == 'thread' ? 'forum' : $key;
$method = $key == 'thread' ? 'board' : 'index';
if (!commonModel::hasPriv($module, $method)) {
unset($this->lang->block->availableBlocks->{$key});
}
}
return json_encode($this->lang->block->availableBlocks);
}
示例9: getAvailableBlocks
/**
* Get block list.
*
* @access public
* @return string
*/
public function getAvailableBlocks()
{
foreach ($this->lang->block->availableBlocks as $key => $block) {
$method = $key == 'project' ? 'index' : 'browse';
if ($key == 'attend') {
$method = 'personal';
}
if (!commonModel::hasPriv($key, $method)) {
unset($this->lang->block->availableBlocks->{$key});
}
}
return json_encode($this->lang->block->availableBlocks);
}
示例10: getList
/**
* Get order list.
*
* @param string $mode
* @param mix $value
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getList($mode, $value, $orderBy = 'id_desc', $pager = null)
{
$days = $this->config->shop->confirmLimit;
if ($days) {
$deliveryDate = date('Y-m-d H:i:s', time() - 24 * 60 * 60 * $days);
$this->dao->update(TABLE_ORDER)->set('deliveryStatus')->eq('confirmed')->where('deliveryStatus')->eq('send')->andWhere('deliveriedDate')->le($deliveryDate)->exec();
}
$orders = $this->dao->select('*')->from(TABLE_ORDER)->beginIf($mode == 'account')->where('account')->eq($value)->fi()->beginIf($mode == 'status')->where('status')->eq($value)->fi()->beginIf(!commonModel::isAvailable('score'))->andWhere('type')->ne('score')->fi()->beginIf(!commonModel::isAvailable('shop'))->andWhere('type')->ne('shop')->fi()->orderBy($orderBy)->page($pager)->fetchAll('id');
$products = $this->dao->select('*')->from(TABLE_ORDER_PRODUCT)->where('orderID')->in(array_keys($orders))->fetchGroup('orderID');
foreach ($orders as $order) {
$order->products = isset($products[$order->id]) ? $products[$order->id] : array();
}
return $orders;
}
示例11: admin
/**
* Nav admin function
*
* @param string $top
* @access public
* @return void
*/
public function admin($type = '')
{
if ($type == '' and $this->config->site->type == 'portal') {
$type = $this->device . '_top';
}
if ($type == '' and $this->config->site->type == 'blog') {
$type = $this->device . '_blog';
}
foreach ($this->lang->nav->system as $module => $name) {
if (!commonModel::isAvailable($module)) {
unset($this->lang->nav->system->{$module});
}
}
if ($_POST) {
$navs = $this->post->nav;
foreach ($navs as $key => $nav) {
$navs[$key] = $this->nav->organizeNav($nav);
}
if (isset($navs[2])) {
$navs[2] = $this->nav->group($navs[2]);
if (isset($navs[3])) {
$navs[3] = $this->nav->group($navs[3]);
}
foreach ($navs[2] as &$navList) {
foreach ($navList as &$nav) {
$nav['children'] = isset($navs[3][$nav['key']]) ? $navs[3][$nav['key']] : array();
}
}
}
foreach ($navs[1] as &$nav) {
$nav['children'] = isset($navs[2][$nav['key']]) ? $navs[2][$nav['key']] : array();
}
$settings = array($type => helper::jsonEncode($navs[1]));
$result = $this->loadModel('setting')->setItems('system.common.nav', $settings);
if ($result) {
$this->send(array('result' => 'success', 'message' => $this->lang->setSuccess));
}
$this->send(array('result' => 'fail', 'message' => $this->lang->failed));
}
$this->view->title = $this->lang->nav->setNav;
$this->view->navs = $this->nav->getNavs($type);
$this->view->type = $type;
$this->view->types = $this->lang->nav->types;
$this->view->articleTree = $this->loadModel('tree')->getOptionMenu('article');
$this->display();
}
示例12: index
/**
* Output the rss.
*
* @access public
* @return void
*/
public function index()
{
$type = $this->get->type != false ? $this->get->type : 'blog';
$this->loadModel('tree');
$this->loadModel('article');
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, isset($this->config->rss->items) ? $this->config->rss->items : 10, 1);
$articles = $this->article->getList($type, $this->tree->getFamily(0, $type), 'id_desc', $pager);
$latestArticle = current((array) $articles);
$this->view->title = $this->config->site->name;
$this->view->desc = $this->config->site->desc;
$this->view->siteLink = $this->inlink('browse', "type={$type}");
$this->view->siteLink = commonModel::getSysURL();
$this->view->articles = $articles;
$this->view->lastDate = $latestArticle ? $latestArticle->addedDate : date('Y-m-d H:i:s') . ' +0800';
$this->display();
}
示例13:
</td>
<td><?php
echo $public->appID;
?>
</td>
<td>
<?php
commonModel::printLink('wechat', 'edit', "publicID={$public->id}", $lang->edit);
if (!$public->certified and $public->type == 'subscribe') {
echo html::a('javascript:;', $lang->wechat->setMenu, "class='text-muted' data-container='body' data-toggle='popover' data-placement='right' data-content='{$lang->wechat->needCertified}'");
} else {
commonModel::printLink('tree', 'browse', "type=wechat_{$public->id}", $lang->wechat->setMenu);
}
commonModel::printLink('wechat', 'adminResponse', "publicID={$public->id}", $lang->wechat->response->keywords);
commonModel::printLink('wechat', 'setResponse', "publicID={$public->id}&group=default&key=default", $lang->wechat->response->default, "data-toggle='modal'");
commonModel::printLink('wechat', 'setResponse', "publicID={$public->id}&group=subscribe&key=subscribe", $lang->wechat->response->subscribe, "data-toggle='modal'");
commonModel::printLink('wechat', 'delete', "publicID={$public->id}", $lang->delete, "class='deleter'");
commonModel::printLink('wechat', 'integrate', "publicID={$public->id}", $lang->wechat->integrate);
commonModel::printLink('wechat', 'qrcode', "publicID={$public->id}", $lang->wechat->qrcode, "data-toggle=modal");
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
}
include '../../common/view/footer.admin.html.php';
示例14:
?>
</td>
<td><?php
echo $log->desc;
?>
</td>
<td><?php
echo $log->browser;
?>
</td>
<td><?php
commonModel::printLink('user', 'adminlog', "ip={$log->ip}", $log->ip);
?>
</td>
<td><?php
commonModel::printLink('user', 'adminlog', "location={$log->location}", $log->location);
?>
</td>
<td><?php
echo $log->date;
?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<td colspan='8'>
<?php
示例15: htmlspecialchars
</div>
</div>
<div class='form-group'>
<label class='col-md-2 control-label'><?php
echo $lang->category->desc;
?>
</label>
<div class='col-md-9'><?php
echo html::textarea('desc', htmlspecialchars($category->desc), "class='form-control' rows=3'");
?>
</div>
</div>
<div class='form-group'>
<label class='col-md-2 control-label'>图片</label>
<div class='col-md-9' style="padding-top:6px;"><?php
commonModel::printLink('file', 'browse', "objectType=category&objectID={$category->id}&isImage=1", '上传图片', "data-toggle='modal'");
?>
</div>
</div>
</div>
<div class='categoryInfo'>
<?php
if ($category->type == 'forum') {
?>
<div class='form-group'>
<label class='col-md-2 control-label'><?php
echo $lang->category->moderators;
?>
</label>
<div class='col-md-9'><?php
echo html::input('moderators', $category->moderators, "class='form-control' placeholder='{$lang->board->placeholder->moderators}'");