Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisramey committed Sep 18, 2011
1 parent 39a311c commit 9b11e24
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ckeditor/skins/kama/editor.css

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions protected/controllers/ChallengeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ public function accessRules()
),
);
}

public function actionView() {
// Get all free form questions associated with this assessment
$models['Challenge'] = $this->loadModel();
$models['Assessment'] = Assessment::model()->findByAttributes(array('task_id'=>$models['Challenge']->id));

public function actionView()
{
$this->render('view',array(
'model'=>$this->loadModel(),
'model'=>$models
));
}

// public function actionView() {


// $this->render('view',array(
// 'model'=>$this->loadModel(),
// ));
// }

public function actionCreate()
{
$model=new Challenge;
Expand Down
37 changes: 19 additions & 18 deletions protected/views/assessment/_view.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<div class="view">

<b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?>
<br />

<b><?php echo CHtml::encode($data->getAttributeLabel('task_id')); ?>:</b>
<?php echo CHtml::encode($data->task_id); ?>
<br />

<b><?php echo CHtml::encode($data->getAttributeLabel('name')); ?>:</b>
<?php echo CHtml::encode($data->name); ?>
<br />

<b><?php echo CHtml::encode($data->getAttributeLabel('type')); ?>:</b>
<?php echo CHtml::encode($data->type); ?>
<br />

<?php
$data = ($model == null) ? $data : $model;
if ($link) {
$title = '<a href="/assessment/view/id/'.$data->id.'">'.$data->name.'</a>';
$description = '';
$actions = '<div class="actions" style="float:right;line-height:30px;">';
$actions .= '<a style="margin:0px 6px;" href="/assessment/update/id/'.$data->id.'"><img style="height:20px;vertical-align:middle;" src="/images/edit.png" alt="Edit"/></a>';
$actions .= '<a style="margin:0px 6px;" href="/assessment/delete/id/'.$data->id.'" onclick="return confirm(\'Are you sure you want to delete this challenge? All related questions will be permnently deleted.\');"><img style="height:20px;vertical-align:middle;" src="/images/delete.png" alt="Delete"/></a>';
$actions .= '</div>';
$style = 'margin:8px 0px;padding:5px;border:1px solid #666;-moz-border-radius:4px;-border-radius:4px;background-color:#fefefe;';
} else {
$title = $model->name;
$description = $model->description;
$actions = '';
$style = 'margin:20px 0px;padding:10px;border:1px solid #555;-moz-border-radius:4px;border-radius:4px;background:#efefef url(/images/brain-icon.png) 98% 6px no-repeat;';
}?>
<div class="question" style="<?php echo $style;?>">
<?php echo $actions;?>
<h2 style="margin:0px;"><?php echo $title;?></h2>
</div>
2 changes: 1 addition & 1 deletion protected/views/challenge/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<?php echo $form->errorSummary($model); ?>

<div style="float:left;margin-right:40px;">
<h2 style="margin-bottom:0px;">Name <span class="required">*</span></h2>
<h2 style="margin:0px;">Name <span class="required">*</span></h2>
<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?>
</div>
<div style="float:left;">
Expand Down
7 changes: 3 additions & 4 deletions protected/views/challenge/_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
$actions = '<div class="actions" style="float:right;line-height:30px;">';
$actions .= '<a style="margin:0px 6px;" href="/challenge/update/id/'.$data->id.'"><img style="height:20px;vertical-align:middle;" src="/images/edit.png" alt="Edit"/></a>';
$actions .= '<a style="margin:0px 6px;" href="/challenge/delete/id/'.$data->id.'" onclick="return confirm(\'Are you sure you want to delete this challenge? All related questions will be permnently deleted.\');"><img style="height:20px;vertical-align:middle;" src="/images/delete.png" alt="Delete"/></a>';
//$actions .= '<form style="" action="/challenge/delete/id/'.$data->id.'" method="post">';
//$actions .= CHtml::imageButton('/images/delete.png',array('submit'=>'/challenge/delete/id/'.$data->id,'height'=>20,'onclick'=>'return confirm("Are you sure you want to delete this challenge? All related questions will be permnently deleted.");'));
//$actions .= '</form>';
$actions .= '</div>';
$style = 'margin:8px 0px;padding:5px;border:1px solid #666;-moz-border-radius:4px;-border-radius:4px;background-color:#fefefe;';
} else {
$title = $model->name;
$description = $model->description;
$actions = '';
$style = 'margin:20px 0px;padding:10px;border:1px solid #555;-moz-border-radius:4px;border-radius:4px;background:#fefefe url(/images/brain-icon.png) 98% 6px no-repeat;';
}
?>
<div class="challenge" style="margin:8px 0px;padding:5px;border:1px solid #666;-moz-border-radius:4px;-border-radius:4px;background-color:#fefefe;">
<div class="challenge" style="<?php echo $style; ?>">
<?php echo $actions;?>
<h2 style="margin:0px;"><?php echo $title;?></h2>
<?php echo $description;?>
Expand Down
33 changes: 18 additions & 15 deletions protected/views/challenge/view.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$this->breadcrumbs=array(
'Challenges'=>array('index'),
$model->name,
$model['Challenge']->name,
);

$this->menu=array(
Expand All @@ -12,18 +12,21 @@
array('label'=>Yii::t('app', 'Manage') . ' Challenge', 'url'=>array('admin')),
);
?>

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


<h2><?php echo Yii::t('app','{relation} ',array('{relation}'=>'Assessment', '{model}'=>'Challenge'));?></h2>
<ul>
<?php
foreach($model->assessments as $foreignobj) {
printf('<li>%s</li>', CHtml::link($foreignobj->name, array('assessment/view', 'id' => $foreignobj->id)));
<div style="margin:20px 0px;padding:10px;border:1px solid #555;-moz-border-radius:4px;border-radius:4px;background:#efefef;">
<h2>Challenge</h2>
<?php echo $this->renderPartial('_view', array(
'model'=>$model['Challenge'],
'form' =>$form,
'link' =>false
));

if($model['Assessment'] != null) {?>
<h2>Assessment</h2>
<?php echo $this->renderPartial('/assessment/_view', array(
'data'=>$model['Assessment'],
'form' =>$form,
'link' => true
));
}
?>
</ul>
?>
</div>

0 comments on commit 9b11e24

Please sign in to comment.