本文整理汇总了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']);
}