Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for all modules using YiiModule etc aliases #65

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
b947244
All modules now use aliases set in UserModule
circulon Nov 29, 2012
5d72f41
All modules now use aliases set in UserModule
circulon Nov 29, 2012
e13e57d
Updated YUM User columns to be more Yii Like (i.e. camel Case)
circulon Nov 29, 2012
948399b
Updated Profile, profile_field , etc to have more uniform Yii like c…
circulon Nov 29, 2012
d186b12
Updated UserGroups for more Uniform Yii like column naming
circulon Nov 29, 2012
c84454d
Fixed Profile Module with accidental merge tags committed
circulon Nov 29, 2012
a185326
Added an Alias for the folder containing all Yum modules
circulon Dec 3, 2012
9ffb2db
Referenced Avatar module correctly with root alias
circulon Dec 3, 2012
14146b2
Referenced Friendship module correctly with root alias
circulon Dec 3, 2012
6d531a1
Referenced Membership module correctly with root alias
circulon Dec 3, 2012
6e78f17
Referenced Message module correctly with root alias
circulon Dec 3, 2012
17715b0
Referenced Profile module correctly with root alias
circulon Dec 3, 2012
3ecc941
Referenced Registration module correctly with root alias
circulon Dec 3, 2012
45707f3
Referenced Role module correctly with root alias
circulon Dec 3, 2012
0b423c8
Referenced Usergroup module correctly with root alias
circulon Dec 3, 2012
16b5cde
Referenced User module correctly with root alias
circulon Dec 3, 2012
fc032b8
Fixed redefinition of Global $_POST error
circulon Dec 3, 2012
c5827db
Fixed the user content area so it now shows all "rows" together in 2 …
circulon Dec 5, 2012
b8de83e
set the default layout which all Controllers now use
circulon Dec 6, 2012
7c08143
added Checking for admin user and setting the layout appropriately
circulon Dec 6, 2012
8f31d0d
Cleaned up some extraneous whitespace
circulon Dec 6, 2012
06ff94e
Fixed Title and breadcrumbs on Grant Permissions page
circulon Dec 6, 2012
95d9b58
Reverted Column Names back to original
circulon Dec 6, 2012
d265d9a
Updated a lot of views to use ->title instead of hardcoding <h1>
circulon Dec 6, 2012
bd5dc43
Tidied up the look of the grant permissions view
circulon Dec 6, 2012
23d807f
Fixed a crash on the view permissions page
circulon Dec 6, 2012
cd6afcd
Fixed Translation table error when starting install due to incorrect …
circulon Dec 7, 2012
931fd65
Reverted column names
circulon Dec 7, 2012
d9f0a1b
Fixed Installation Error for translation table not using the default …
circulon Dec 7, 2012
c082399
Replaced all short tags with full <?php tags to fix issues with non a…
circulon Dec 12, 2012
cdac699
Fixed incorrect referencing of messages module
circulon Jan 6, 2013
c9f6395
All modules now use aliases set in UserModule
circulon Nov 29, 2012
57dc35f
All modules now use aliases set in UserModule
circulon Nov 29, 2012
b5aec52
Updated YUM User columns to be more Yii Like (i.e. camel Case)
circulon Nov 29, 2012
2a408f6
Updated Profile, profile_field , etc to have more uniform Yii like c…
circulon Nov 29, 2012
fc02b3d
Updated UserGroups for more Uniform Yii like column naming
circulon Nov 29, 2012
7daf716
Fixed Profile Module with accidental merge tags committed
circulon Nov 29, 2012
7f20eda
Added an Alias for the folder containing all Yum modules
circulon Dec 3, 2012
68214f3
Referenced Avatar module correctly with root alias
circulon Dec 3, 2012
f3fcd2b
Referenced Friendship module correctly with root alias
circulon Dec 3, 2012
2c8b00a
Referenced Membership module correctly with root alias
circulon Dec 3, 2012
34f09e1
Referenced Message module correctly with root alias
circulon Dec 3, 2012
a1b5b1f
Referenced Profile module correctly with root alias
circulon Dec 3, 2012
bfe2de8
Referenced Registration module correctly with root alias
circulon Dec 3, 2012
5e363a9
Referenced Role module correctly with root alias
circulon Dec 3, 2012
8085907
Referenced Usergroup module correctly with root alias
circulon Dec 3, 2012
848bbfc
Referenced User module correctly with root alias
circulon Dec 3, 2012
fbb44d9
Fixed redefinition of Global $_POST error
circulon Dec 3, 2012
739b081
Fixed the user content area so it now shows all "rows" together in 2 …
circulon Dec 5, 2012
f62ec2c
set the default layout which all Controllers now use
circulon Dec 6, 2012
1e905ec
added Checking for admin user and setting the layout appropriately
circulon Dec 6, 2012
cf59a58
Cleaned up some extraneous whitespace
circulon Dec 6, 2012
1c32686
Fixed Title and breadcrumbs on Grant Permissions page
circulon Dec 6, 2012
3ef78a7
Reverted Column Names back to original
circulon Dec 6, 2012
e7d6553
Updated a lot of views to use ->title instead of hardcoding <h1>
circulon Dec 6, 2012
0d9036b
Tidied up the look of the grant permissions view
circulon Dec 6, 2012
7687823
Fixed a crash on the view permissions page
circulon Dec 6, 2012
a4d7ac2
Fixed Translation table error when starting install due to incorrect …
circulon Dec 7, 2012
7e18703
Reverted column names
circulon Dec 7, 2012
f38cce3
Fixed Installation Error for translation table not using the default …
circulon Dec 7, 2012
1fc6b39
Replaced all short tags with full <?php tags to fix issues with non a…
circulon Dec 12, 2012
13b8b60
Fixed incorrect referencing of messages module
circulon Jan 6, 2013
f1a4f03
Fix Typo
circulon Jan 11, 2013
e0606a4
Manual Merge from thyseus/master
circulon Jan 11, 2013
ecac8ee
- Fixed short php tags from merge
circulon Jan 13, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions avatar/AvatarModule.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?
<?php
Yii::setPathOfAlias('AvatarModule' , dirname(__FILE__));
Yii::setPathOfAlias('YumModulesRoot' , dirname(dirname(__FILE__)));

class AvatarModule extends CWebModule {
public $defaultController = 'avatar';

// override this with your custom layout, if available
public $layout = 'application.modules.user.views.layouts.yum';
public $layout = 'YumModulesRoot.user.views.layouts.yum';

public $avatarPath = 'images';

Expand All @@ -23,10 +24,10 @@ class AvatarModule extends CWebModule {

public function init() {
$this->setImport(array(
'application.modules.user.controllers.*',
'application.modules.user.models.*',
'application.modules.avatar.controllers.*',
'application.modules.avatar.models.*',
'YumModulesRoot.user.controllers.*',
'YumModulesRoot.user.models.*',
'YumModulesRoot.avatar.controllers.*',
'YumModulesRoot.avatar.models.*',
));
}

Expand Down
10 changes: 5 additions & 5 deletions avatar/controllers/YumAvatarController.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?
<?php

// This controller handles the upload and the deletion of an Avatar
// image for the user profile.

Yii::import('application.modules.user.controllers.YumController');
Yii::import('YumModulesRoot.user.controllers.YumController');

class YumAvatarController extends YumController {
public function actionRemoveAvatar() {
$model = YumUser::model()->findByPk(Yii::app()->user->id);
$model->avatar = '';
$model->save();
$this->redirect(array(
Yum::module('profile')->profileViewRoute));
Yum::module('profile')->profileViewRoute));
}

public function actionEnableGravatar() {
$model = YumUser::model()->findByPk(Yii::app()->user->id);
$model->avatar = 'gravatar';
$model->save();
$this->redirect(array(
Yum::module('profile')->profileViewRoute));
Yum::module('profile')->profileViewRoute));
}

public function beforeAction($action) {
Expand Down Expand Up @@ -53,7 +53,7 @@ public function actionEditAvatar() {
Yum::log(Yum::t('User {username} uploaded avatar image {filename}', array(
'{username}' => $model->username,
'{filename}' => $model->avatar)));
$this->redirect(array('//profile/profile/view'));
$this->redirect(array('//profile/profile/view'));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion avatar/views/avatar/edit_avatar.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="form">
<?
<?php
$this->title = Yum::t('Upload avatar');

$this->breadcrumbs = array(
Expand Down
2 changes: 1 addition & 1 deletion friendship/FriendshipModule.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
Yii::setPathOfAlias('FriendshipModule' , dirname(__FILE__));

class FriendshipModule extends CWebModule {
Expand Down
24 changes: 12 additions & 12 deletions friendship/controllers/YumFriendshipController.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?
Yii::import('application.modules.user.controllers.YumController');
Yii::import('application.modules.user.components.*');
Yii::import('application.modules.user.models.*');
Yii::import('application.modules.friendship.models.*');
<?php
Yii::import('YumModulesRoot.user.controllers.YumController');
Yii::import('YumComponents.*');
Yii::import('YumModulesRoot.user.models.*');
Yii::import('YumModulesRoot.friendship.models.*');

class YumFriendshipController extends YumController {
// make sure that friendship is enabled in the configuration
public function beforeAction($action) {
if(!Yum::hasModule('friendship'))
if(!Yum::hasModule('friendship'))
return false;
return(parent::beforeAction($action));
}

public function actionIndex() {
if(isset($_POST['YumFriendship']['inviter_id'])
if(isset($_POST['YumFriendship']['inviter_id'])
&& isset($_POST['YumFriendship']['friend_id']) ) {
$friendship = YumFriendship::model()->find(
'inviter_id = :inviter_id and friend_id = :friend_id', array(
':inviter_id' => $_POST['YumFriendship']['inviter_id'],
':friend_id' => $_POST['YumFriendship']['friend_id']));

if(isset($friendship))
if($friendship->inviter_id == Yii::app()->user->id
if($friendship->inviter_id == Yii::app()->user->id
|| $friendship->friend_id == Yii::app()->user->id)
if(isset($_POST['YumFriendship']['add_request']))
{
Expand All @@ -32,7 +32,7 @@ public function actionIndex() {
} elseif(isset($_POST['YumFriendship']['ignore_request'])) {
$friendship->status = 0;
$friendship->save();
} elseif(isset($_POST['YumFriendship']['cancel_request'])
} elseif(isset($_POST['YumFriendship']['cancel_request'])
|| isset($_POST['YumFriendship']['remove_friend'])) {
$friendship->delete();
}
Expand All @@ -54,7 +54,7 @@ public function actionAdmin() {

$this->render('admin', array('friendships' => $friendships));

}
}

public function actionInvite($user_id = null) {
if(isset($_POST['user_id']))
Expand All @@ -71,7 +71,7 @@ public function actionInvite($user_id = null) {
Yum::setFlash('The friendship request has been sent');
$this->redirect(array('//profile/profile/view', 'id' => $user_id));
}
}
}

$this->render('invitation', array(
'inviter' => YumUser::model()->findByPk(Yii::app()->user->id),
Expand Down Expand Up @@ -149,7 +149,7 @@ public static function invitationLink($inviter, $invited) {

$friends = $inviter->getFriends(true);
if($friends && $friends[0] != NULL)
foreach($friends as $friend)
foreach($friends as $friend)
if($friend->id == $invited->id)
return false; // already friends, rejected or request pending

Expand Down
26 changes: 13 additions & 13 deletions friendship/models/YumFriendship.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?
<?php

class YumFriendship extends YumActiveRecord {
const FRIENDSHIP_NONE = 0;
const FRIENDSHIP_NONE = 0;
const FRIENDSHIP_REQUEST = 1;
const FRIENDSHIP_ACCEPTED = 2;
const FRIENDSHIP_REJECTED = 3;
Expand Down Expand Up @@ -44,7 +44,7 @@ public function requestFriendship($inviter, $invited, $message = null) {
$this->message = $message;
$this->status = 1;
return $this->save();
}
}

// How many friendship requests have been made in month $month of year $year?
public static function countRequest($month = null, $year = null) {
Expand All @@ -64,19 +64,19 @@ public static function countRequest($month = null, $year = null) {
public function acceptFriendship() {
$this->acknowledgetime = time();
$this->status = 2;
if(Yum::hasModule('message')
&& isset($this->inviter->privacy)
if(Yum::hasModule('message')
&& isset($this->inviter->privacy)
&& $this->inviter->privacy->message_new_friendship) {
Yii::import('application.modules.message.models.YumMessage');
Yii::import('YumModulesRoot.message.models.YumMessage');
YumMessage::write($this->inviter, $this->invited,
Yum::t('Your friendship request has been accepted'),
strtr(
'Your friendship request to {username} has been accepted', array(
'{username}' => $this->inviter->username)));
'{username}' => $this->inviter->username)));
}
$this->save(false, array('acknowledgetime', 'status'));

}
}

public function getFriend() {
if($this->friend_id == Yii::app()->user->id)
Expand All @@ -103,13 +103,13 @@ public function rejectFriendship() {
$this->acknowledgetime = time();
$this->status = 3;
return($this->save());
}
}

public function ignoreFriendship() {
$this->acknowledgetime = time();
$this->status = 0;
return($this->save());
}
}

public function tableName()
{
Expand Down Expand Up @@ -156,9 +156,9 @@ public function beforeSave() {
if($this->isNewRecord)
if($user = YumUser::model()->findByPk($this->friend_id)) {
if(Yum::hasModule('message')
&& $user->privacy
&& $user->privacy
&& $user->privacy->message_new_friendship) {
Yii::import('application.modules.message.models.YumMessage');
Yii::import('YumModulesRoot.message.models.YumMessage');
YumMessage::write($user, $this->inviter,
Yum::t('New friendship request from {username}', array(
'{username}' => $this->inviter->username)),
Expand Down Expand Up @@ -199,7 +199,7 @@ public static function areFriends($uid1, $uid2) {
$friendship = YumFriendship::model()->find('status = 2 and inviter_id = '.$uid2 . ' and friend_id = '.$uid1);
if($friendship)
return true;
}
}
return false;

}
Expand Down
36 changes: 18 additions & 18 deletions friendship/views/friendship/_form.php
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
<div class="form">

<? $form=$this->beginWidget('CActiveForm', array(
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'groups-form',
'enableAjaxValidation'=>false,
)); ?>



<? echo $form->errorSummary($model); ?>
<?php echo $form->errorSummary($model); ?>

<div class="row">
<? echo $form->label($model,'inviter_id'); ?>
<? echo $form->textField($model->inviter,'username',array(
<?php echo $form->label($model,'inviter_id'); ?>
<?php echo $form->textField($model->inviter,'username',array(
'size'=>20,'maxlength'=>25,'readonly'=>'readonly')); ?>
<? echo $form->error($model,'inviter_id'); ?>
<?php echo $form->error($model,'inviter_id'); ?>
</div>

<div class="row">
<? echo $form->label($model,'status'); ?>
<?
<?php echo $form->label($model,'status'); ?>
<?php
echo CHtml::activeDropDownList($model,
'status',array('0'=>'No friendship requested','1'=>'Confirmation pending','2'=>'Friendship confirmed','3'=>'Friendship rejected'));
?>
<? echo $form->error($model,'status'); ?>
<?php echo $form->error($model,'status'); ?>
</div>



<div class="row">
<? echo $form->label($model,'friend_id'); ?>
<? echo $form->textField($model->invited,'username',array(
<?php echo $form->label($model,'friend_id'); ?>
<?php echo $form->textField($model->invited,'username',array(
'size'=>20,'maxlength'=>25,'readonly'=>'readonly')); ?>
<? echo $form->error($model,'friend_id'); ?>
<?php echo $form->error($model,'friend_id'); ?>
</div>

<div class="row">
<? echo $form->label($model,'message'); ?>
<? echo $form->textArea($model,'message'); ?>
<? echo $form->error($model,'message'); ?>
<?php echo $form->label($model,'message'); ?>
<?php echo $form->textArea($model,'message'); ?>
<?php echo $form->error($model,'message'); ?>
</div>





<div class="row buttons">
<? echo CHtml::submitButton($model->isNewRecord ? Yii::t('App', 'Create') : Yii::t('App', 'Save')); ?>
<?php echo CHtml::submitButton($model->isNewRecord ? Yii::t('App', 'Create') : Yii::t('App', 'Save')); ?>
</div>

<? $this->endWidget(); ?>
<?php $this->endWidget(); ?>

</div><!-- form -->
2 changes: 1 addition & 1 deletion friendship/views/friendship/_view.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?
<?php
printf('<h2>%s</h2>', $data->invited->username);
?>
2 changes: 1 addition & 1 deletion friendship/views/friendship/admin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
$this->title = Yum::t('Friendship administration');
$this->breadcrumbs = array('Friends', 'Admin');

Expand Down
2 changes: 1 addition & 1 deletion friendship/views/friendship/friendedit.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
$this->title = Yum::t(ucfirst($user->username) .'\'s friends');
$this->breadcrumbs = array('Friends', $user->username);

Expand Down
10 changes: 5 additions & 5 deletions friendship/views/friendship/friends.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
if(!$profile = @$model->profile)
return false;

Expand All @@ -11,19 +11,19 @@
?>
<div class="friend">
<div class="avatar">
<?
<?php
echo $friend->getAvatar(true);
?>
<div class="username">
<?
<?php
echo CHtml::link(ucwords($friend->username),
Yii::app()->createUrl('//profile/profile/view',array(
'id'=>$friend->id)));
?>
</div>
</div>
</div>
<?
<?php
}
} else {
echo Yum::t('{username} has no friends yet', array(
Expand All @@ -32,6 +32,6 @@
echo '</div><!-- friends -->';
}
Yii::import(
'application.modules.friendship.controllers.YumFriendshipController');
'YumModulesRoot.friendship.controllers.YumFriendshipController');
echo YumFriendshipController::invitationLink(Yii::app()->user->id, $model->id);
?>
2 changes: 1 addition & 1 deletion friendship/views/friendship/invitation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
$this->title = Yum::t('Request friendship for user {username}', array(
'{username}' => $invited->username));
$this->breadcrumbs = array(
Expand Down
2 changes: 1 addition & 1 deletion friendship/views/friendship/myfriends.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
$this->title = Yum::t('My friends');
$this->breadcrumbs = array(Yum::t('Friends'));

Expand Down
2 changes: 1 addition & 1 deletion friendship/views/friendship/new_friends.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
$user = YumUser::model()->findByPk(Yii::app()->user->id);

if($user->friendship_requests) {
Expand Down
6 changes: 3 additions & 3 deletions friendship/views/friendship/update.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?
<?php
$this->breadcrumbs=array(
Yum::t('Friendships')=>array('index'),
$model->id=>array('view','id'=>$model->id),
'Update',
);
?>

<h1>Update Friendship #<? echo $model->id; ?></h1>
<h1>Update Friendship #<?php echo $model->id; ?></h1>

<? echo $this->renderPartial('_form', array('model'=>$model)); ?>
<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
Loading