本文整理匯總了PHP中BaseAction::base方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseAction::base方法的具體用法?PHP BaseAction::base怎麽用?PHP BaseAction::base使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BaseAction
的用法示例。
在下文中一共展示了BaseAction::base方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _initialize
public function _initialize()
{
parent::base();
$this->group = D('Group');
/*
* 右側信息
*/
if (in_array(ACTION_NAME, array('find', 'search', 'add'))) {
// 加入的圈子的數量
$join_group_count = D('Member')->where('(level>1 AND status=1) AND uid=' . $this->mid)->count();
$this->assign('join_group_count', $join_group_count);
// 熱門標簽
$hot_tags_list = D('GroupTag')->getHotTags();
$this->assign('hot_tags_list', $hot_tags_list);
// 圈子熱門排行
$hot_group_list = $this->group->getHotList();
$this->assign('hot_group_list', $hot_group_list);
} else {
if (in_array(ACTION_NAME, array('index', 'message', 'post', 'replied', 'comment', 'atme', 'bbsNotify'))) {
//檢查所有模板裏麵需要檢查項
$check['inIndex'] = in_array(ACTION_NAME, array('index', 'message'));
$check['newly'] = $check['inIndex'] ? on : off;
$check['postly'] = ACTION_NAME == 'post' ? "on" : "off";
$check['replied'] = ACTION_NAME == "replied" ? "on" : "off";
$check['commentes'] = ACTION_NAME == 'comment' ? "on" : "off";
$check['bbsNotifyes'] = ACTION_NAME == 'bbsNotify' ? 'on' : "off";
$check['atmes'] = ACTION_NAME == 'atme' ? 'on' : 'off';
$this->assign($check);
$this->assign('userCount', D('GroupUserCount', 'group')->getUnreadCount($this->mid));
}
}
}
示例2: _initialize
public function _initialize()
{
parent::base();
//$this->mid = 39;//$this->mid; 39 40 ,42
$this->perpage = 3;
$this->group = D('group');
}
示例3: _initialize
public function _initialize()
{
parent::base();
/*
* 右側信息
*/
// 加入的群組的數量
$join_group_count = D('Member')->where('(level>1 AND status=1) AND uid=' . $this->mid)->count();
$this->assign('join_group_count', $join_group_count);
// 熱門標簽
$hot_tags_list = D('GroupTag')->getHotTags();
$this->assign('hot_tags_list', $hot_tags_list);
// 群組熱門排行
$hot_group_list = D('Group')->getHotList();
//dump($hot_group_list);exit;
$this->assign('hot_group_list', $hot_group_list);
}
示例4: _initialize
public function _initialize()
{
parent::base();
}
示例5: joinGroup
public function joinGroup()
{
if (isset($_POST['addsubmit'])) {
$level = 0;
$incMemberCount = false;
if ($this->is_invited) {
M('group_invite_verify')->where("gid={$this->gid} AND uid={$this->mid} AND is_used=0")->save(array('is_used' => 1));
if (0 === intval($_POST['accept'])) {
// 拒絕邀請
exit;
} else {
// 接受邀請加入
$level = 3;
$incMemberCount = ture;
}
} else {
if ($this->groupinfo['need_invite'] == 0) {
// 直接加入
$level = 3;
$incMemberCount = ture;
} else {
if ($this->groupinfo['need_invite'] == 1) {
// 需要審批,發送私信到管理員
$level = 0;
$incMemberCount = false;
// 添加通知
$toUserIds = D('Member')->field('uid')->where('gid=' . $this->gid . ' AND (level=1 or level=2)')->findAll();
foreach ($toUserIds as $k => $v) {
$toUserIds[$k] = $v['uid'];
}
$message_data['title'] = "申請加入圈子 {$this->groupinfo['name']}";
$message_data['content'] = "你好,請求你批準加入“{$this->groupinfo['name']}” 圈子,點此" . "<a href='" . U('group/Manage/membermanage', array('gid' => $this->gid, 'type' => 'apply')) . "' target='_blank'>" . U('group/Manage/membermanage', array('gid' => $this->gid, 'type' => 'apply')) . '</a>進行操作。';
$message_data['to'] = $toUserIds;
$res = model('Message')->postMessage($message_data, $this->mid);
}
}
}
$result = D('Group')->joinGroup($this->mid, $this->gid, $level, $incMemberCount, $_POST['reason']);
//加入
S('Cache_MyGroup_' . $this->mid, null);
exit;
}
parent::base();
$this->assign('joinCount', D('Member')->where("uid={$this->mid} AND level>1")->count());
$member_info = D('Member')->field('level')->where("gid={$this->gid} AND uid={$this->mid}")->find();
$this->assign('isjoin', $member_info['level']);
// 是否加入過或加入情況
$this->display();
}
示例6: upload
function upload()
{
//權限判讀 用戶沒有加入該群組
if (!$this->ismember) {
$this->error('對不起,您不是群內成員');
}
//係統後台配置僅管理員可以上傳
if ($this->groupinfo['whoUploadFile'] == 2 && !$this->isadmin) {
$this->error('對不起,僅管理員可以上傳文件');
}
parent::base();
$usedSpace = $this->dir->join('as a inner join ' . C('DB_PREFIX') . 'attach as b on a.attachId=b.attach_id ')->where('a.gid=' . $this->gid . ' AND a.is_del=0')->sum('b.size');
//判讀空間大小
$uploadSize = intval($_FILES['uploadfile']['size']);
$usedSpace = intval($usedSpace) + $uploadSize;
if ($usedSpace >= $this->config['spaceSize'] * 1024 * 1024) {
if ($_GET['ajax'] == 1) {
exit(json_encode(array('status' => 0, 'info' => '空間已經使用完!')));
}
$this->error('空間已經使用完');
//如果使用完,提示錯誤信息
}
if (isset($_POST['uploadsubmit']) || $_GET['ajax'] == 1) {
//上傳參數
$upload['max_size'] = $this->config['simpleFileSize'] * 1024 * 1024;
$upload['allow_exts'] = str_replace('|', ',', $this->config['uploadFileType']);
$upload['attach_type'] = 'groupfile';
$info = model('Attach')->upload(null, $upload);
//執行上傳操作
if ($info['status']) {
//上傳成功
$uploadFileInfo = $info['info'][0];
$attchement['gid'] = $this->gid;
$attchement['uid'] = $this->mid;
$attchement['attachId'] = $uploadFileInfo['attach_id'];
$attchement['name'] = $uploadFileInfo['name'];
$attchement['note'] = !empty($_POST['note']) ? t($_POST['note']) : '';
$attchement['filesize'] = $uploadFileInfo['size'];
$attchement['filetype'] = $uploadFileInfo['extension'];
$attchement['fileurl'] = $uploadFileInfo['save_path'] . $uploadFileInfo['save_name'];
$attchement['ctime'] = time();
if ($_GET['ajax'] == 1) {
$attchement['is_del'] = 1;
// 異步上傳的文件默認為刪除狀態,等異步信息保存時候再設定為非刪除
}
$result = $this->dir->add($attchement);
if ($result) {
// 積分
// X('Credit')->setUserCredit($this->mid, 'group_upload_file');
if ($_GET['ajax'] == 1) {
$info['info']['0']['id'] = $result;
exit(json_encode($info));
}
//添加動態
/*$title_data["actor"] = getUserName($this->mid);
$title_data['gid'] = $this->gid;
$title_data['group_name'] = $this->groupinfo['name'];
//$body_data['url'] = __APP__."/Dir/file/gid/{$this->gid}/fid/".$result;
$body_data['name'] = $uploadFileInfo['name'];
$body_data['gid'] = $this->gid;
$body_data['fid'] = $result;
$appid= 'group_'.$this->gid;
$this->api->feed_publish('group_file',$title_data,$body_data,$this->appId,0,$this->gid);
setScore($this->mid,'group_file_upload');*/
//$this->assign('fid',$result);
//$this->assign('uploadSuccess',true);
$_SESSION['uploadSuccess'] = 1;
$this->redirect('group/Dir/upload', array('gid' => $this->gid, 'fid' => $result));
} else {
if ($_GET['ajax'] == 1) {
exit(json_encode(array('status' => 0, 'info' => '保存文件失敗')));
}
$this->error('保存文件失敗');
}
} else {
if ($_GET['ajax'] == 1) {
exit(json_encode($info));
}
$this->error($info['info']);
}
}
$this->setTitle($this->siteTitle['file_upload']);
$this->assign('uploadType', str_replace('|', ',', $this->config['uploadFileType']));
$this->assign('upload', $upload);
$this->display();
unset($_SESSION['uploadSuccess']);
}