Video Points, Cost
Hi guys,
I need help with video points,... I'm creating feature that users can
promote their videos, groups,... etc... in my social network site. In
order to do that we need video promotion cost, which is in this case
is points. And ADMIN can update points any time from control panel.
Say default is 300 points, and in one month I can increase to 350 or
make at less to 250.
And I can't make it work, Its kind of adding points to and
auto_increment id, and I want it to update ONLY the cost, and NOT TO
auto_increment id.
Here is what I have
In my video_controller.php
function admin_points()
{
//print_r($_SESSION);
$this->VideoPoint->cost = $id;
if(!($points = $this->VideoPoint->findById($id)))
$this->set('points', $points);
$this->set_title(ucfirst(i18n::translate('edit Video Cost')));
if(empty($this->data))
{
$this->data['VideoPoint']['cost'] = $points;
// $this->data = $points;
}
else
{
if($this->VideoPoint->save($this->data))
{
$this->flash('valid', ucfirst(i18n::translate('Video Costs
Updated Succesfully')));
$this->redirect('/admin/videos/points/');
}
}
}
In models: video_point.php
<?php
class VideoPoint extends AppModel {
var $name = 'VideoPoint';
var $validate = array(
'cost' => VALID_NOT_EMPTY
);
var $belongsTo = array( );
function afterDelete()
{
}
}
?>
And in View ../views/videos/admin_points.ctp
<form id="admin_points" method="post" >
<table style="width: 620px;" align="center">
<tr>
<th><label for="VideoPointCost"><?php echo ucfirst(__('Video
Cost', true)) ?></label></th>
<td><?php echo $form->text('VideoPoint/cost', array('value' =>
$points ,'style' => 'width: 200px')) ?></td>
</tr>
</table>
<p>
<div class="buttons" style="float: right; margin-right: 60px;">
<button type="submit" class="positive">
<?php echo $html->image('tick.png') ?>
<?php echo ucfirst(__('save', true)) ?>
</button>
</div>
</p>
<div class="clr"></div>
</form>
Thank You for your help in advance !!
Chris
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home