approve a row in a table

A place for users and developers of the Xataface to discuss and receive support.

approve a row in a table

Postby samhans » Mon Feb 13, 2012 9:35 am

hai,
my problem is with the selected row operations. i have done according to the tutorial but error popped up while listing the table.

might be there is some error.

can anyone just give me step by step instructions . starting from table
thanks in advance
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: approve a row in a table

Postby samhans » Mon Feb 13, 2012 9:15 pm

sir,

i have pasted the exact code but on going to approve_demand.php in my actions folder i am getting unexpected ',' in line no 13. parse error .
is i am missing something.
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: approve a row in a table

Postby shannah » Tue Feb 14, 2012 11:22 am

Post the code... and let me know which line is line 13.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: approve a row in a table

Postby samhans » Tue Feb 14, 2012 11:33 am

<?php
class actions_approve_demand{
function handle(&$params){
// First get the selected records
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$records =& df_get_selected_records($query);

$updated = 0; // Count the number of records we update
$errs = array(); // Log the errors we encounter

foreach ($records as $rec){
if ( !$rec->checkPermission('edit'), array('field'=>'approved')) ){
$errs[] = Dataface_Error::permissionDenied(
"You do not have permission to approve '".
$rec->getTitle().
"' because you do not have the 'edit' permission.");
continue;
}
$rec->setValue('approved', 1);

$res = $rec->save(true /*secure*/);
if ( PEAR::isError($res) ) $errs[] = $res->getMessage();
else $updated++;

}

if ( $errs ){
// Errors occurred. Let's let the user know.
// The $_SESSION['--msg'] content will be displayed to the user as a message
// in the next page request.
$_SESSION['--msg'] = 'Errors Occurred:<br/> '.implode('<br/> ', $errs);
} else {
$_SESSION['--msg'] = "No errors occurred";
}


$url = $app->url('-action=list'); // A default URL in case no redirect was supplied
if ( @$_POST['--redirect'] ) $url = base64_decode($_POST['--redirect']);
$url .= '&--msg='.urlencode($updated.' records were deleted.');

// Redirect back to the previous page
header('Location: '.$url);
exit;
}
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: approve a row in a table

Postby samhans » Tue Feb 14, 2012 11:40 am

hai Steve,
waiting for your reply. just posted the code.
actually i want to make a demand and issue system. where there is a demand table. and approve column . while seeing the select record action documentation i have done.
the approve menu comes in with selected tab. but when i select a record and click on approve error pops up saying parse error unexpected ','at line 13 .
i have checked the code and found nothing.
just pasted the exact code for your reply.
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: approve a row in a table

Postby shannah » Tue Feb 14, 2012 11:51 am

As the parser says. You problem is on line 13:
Code: Select all
if ( !$rec->checkPermission('edit'), array('field'=>'approved')) ){


It should be

Code: Select all
if ( !$rec->checkPermission('edit', array('field'=>'approved')) ){


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: approve a row in a table

Postby samhans » Tue Feb 14, 2012 12:23 pm

Steve i will check a come back to you.
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: approve a row in a table

Postby samhans » Tue Feb 14, 2012 11:21 pm

hai steve
lots of problem, when i have done what you have suggested to line 13. now its come a line 16 unexpected t_variable.

steve , please review the entire code. i cant find any soluton.

please give me a fresh code of approving a record. :?:

thanks in advance
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: approve a row in a table

Postby shannah » Wed Feb 15, 2012 9:48 am

Where did you get this code? Any time you copy and paste code, you may need to do some debugging. The parser tells you what line the problem is on, you should be able to then eye-ball what the problem is on that line.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: approve a row in a table

Postby samhans » Wed Feb 15, 2012 10:07 am

hai Steve,
i.have taken the code from your tutorial . i have modified it according to make my need. but stuck on every syntax. the error is persistently coming. when i ratified one line.. other error comes. can you give me a sample example for creating this approve action . it will be of immense help.
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 4 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved