Skip to content

Commit

Permalink
some modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
thevikas committed May 28, 2013
1 parent 4a24cfe commit c4ce6b0
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 7 deletions.
19 changes: 19 additions & 0 deletions css/main.css
Expand Up @@ -235,4 +235,23 @@ div.scorebox h2
{
color: blue;
font-weight: bold;
}
div.linkbox a
{
text-align: center;
width: 50px;
float:right;
display: block;
padding: 2px;
background-color: yellow;
border: solid 1px black;
}
div.linkbox a.active
{
background-color: blue;
color: white;
}
div.linkbox > a
{
f3loat: none;
}
Binary file modified docs/PeerTask - Flow - v2.odg
Binary file not shown.
17 changes: 15 additions & 2 deletions protected/controllers/ObjectivesController.php
Expand Up @@ -36,10 +36,23 @@ public function actionUpdate($id)
));
}

public function actionIndex()
public function actionIndex($show = 'all')
{
$allactive = $mineactive = $sharedactive = '';
switch($show)
{
case 'all':
$allactive = 'active';
break;
case 'mine':
$mineactive = 'active';
break;
case 'shared':
$sharedactive = 'active';
break;
}
$obs = self::$dic->get('Objective')->bytaskuser(Yii::app()->user->id)->findAll();
$this->render('index',array('objectives' => $obs));
$this->render('index',array('objectives' => $obs,'allactive' => $allactive,'sharedactive' =>$sharedactive,'mineactive' => $mineactive));
}

public function actionNew()
Expand Down
2 changes: 1 addition & 1 deletion protected/controllers/SiteController.php
Expand Up @@ -302,7 +302,6 @@ public function actionCron()
}

print_r($userscore);
//die;

foreach($userscore as $uid => $s)
{
Expand All @@ -313,6 +312,7 @@ public function actionCron()
$person = $user->person;
$person->score = $s;
$person->update(array('score'));
Log::model()->logUpdateScore($person);
}
}
}
8 changes: 8 additions & 0 deletions protected/models/Log.php
Expand Up @@ -25,6 +25,7 @@ class Log extends CActiveRecord
const L_FAILTASKWEEKLY = 11;
const L_FAILTASKMONTHLY = 12;
const L_FAILTASKFRIEND = 13;
const L_UPDATEDSCORE = 14;


var $logtypes = array(
Expand All @@ -41,6 +42,7 @@ class Log extends CActiveRecord
self::L_FAILTASKWEEKLY,
self::L_FAILTASKMONTHLY,
self::L_FAILTASKFRIEND,
self::L_UPDATEDSCORE,
);


Expand All @@ -61,6 +63,12 @@ public function logthis($logtype,$id_user,$params)
return $rt;
}

public function logUpdateScore(Person $person)
{
$params = array('score' => $person->score);
$this->logthis(self::L_UPDATEDSCORE,$person->user->id_user,$params);
}

public function logAddFriend($friend)
{
$params = array('id_friend' => $friend->id_friend);
Expand Down
6 changes: 2 additions & 4 deletions protected/views/layouts/main.php
Expand Up @@ -39,13 +39,11 @@
array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Objectives', 'url'=>array('/objectives/'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Friends', 'url'=>array('/friends/'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Add my New Task', 'url'=>array('/tasks/new'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Update Task Logbook', 'url'=>array('/tasks/logbook'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Add my New Task', 'url'=>array('/tasks/new'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'New Objective', 'url'=>array('/objectives/new'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'New Friend', 'url'=>array('/friends/new'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Scoreboard', 'url'=>array('/scores'), 'visible'=>!Yii::app()->user->isGuest),
//array('label'=>'Github', 'url'=>'https://github.com/thevikas/peertask'),

//array('label'=>'Github', 'url'=>'https://github.com/thevikas/peertask'),
),
)); ?>
</div><!-- mainmenu -->
Expand Down
6 changes: 6 additions & 0 deletions protected/views/objectives/index.php
Expand Up @@ -7,6 +7,12 @@
?>
<h1><?php echo $this->id . '/' . $this->action->id; ?></h1>

<div class="linkbox">
<?php echo CHtml::link('Shared',array('/objectives/index','show' => 'shared'),array('class' => $sharedactive)); ?>
<?php echo CHtml::link('Mine',array('/objectives/index','show' => 'mine'),array('class' => $mineactive)); ?>
<?php echo CHtml::link('All',array('/objectives/index','show' => 'all'),array('class' => $allactive)); ?>
</div>

<ol>
<?php
foreach($objectives as $obj)
Expand Down

0 comments on commit c4ce6b0

Please sign in to comment.