distribution

generate hop count.
pull/63/head
noud 2012-11-28 13:19:20 +01:00
parent d301f201b9
commit 324d58d532
1 changed files with 19 additions and 0 deletions

View File

@ -440,6 +440,25 @@ class AppController extends Controller {
}
}
/**
* generate Hop count
* 0: orig
* +1: one step downstream
*
* @param unknown_type $yourOrg being f.i. 'NCIRC' or 'MIL.be'
*/
public function generateHop($yourOrg = 'NCIRC') {
if (!self::_isAdmin()) throw new NotFoundException();
$this->loadModel('Event');
$events = $this->Event->find('all', array('recursive' => 0));
// for all attributes..
foreach ($events as $event) {
$event['Event']['hop_count'] = $event['Event']['org'] == $yourOrg ? '0' : '1';
$this->Event->save($event);
}
}
/**
* CakePHP returns false if filesize is 0 at lib/cake/Utility/File.php:384
*/