Campustream 1.0
A social network MQP for WPI
application/tasks/questions.php
Go to the documentation of this file.
00001 <?
00002 
00003 group('question');
00004 
00005 desc('Delete a question');
00006 task('delete', function ($args) {
00007 
00008         $id = base_convert(array_shift($args), 36, 10);
00009         
00010         $question = ActiveRecord::find('Question_Model', "SELECT * FROM questions WHERE id = $id LIMIT 1");
00011         if (!$question->is_loaded()) {
00012                 echo "Invalid question ID\n";
00013                 return true;
00014         }
00015         
00016         $question->deleted = 1;
00017         $question->save();
00018         
00019         echo "Question #$id deleted\n";
00020         
00021 });