public function actionAddQueue($parent_id = null)
{
$parent = null;
$queue = new models\Queue();
if ($parent_id) {
if (!($parent = models\Queue::model()->findByPk($parent_id))) {
throw new \CHttpException(404, "Queue not found with id {$parent_id}");
}
$queue->is_initial = false;
}
if (!empty($_POST)) {
if (@$_POST['parent_id']) {
if (!($parent = models\Queue::model()->findByPk($_POST['parent_id']))) {
throw new \CHttpException(404, "Queue not found with id {$_POST['parent_id']}");
}
}
$this->saveQueue($queue, $parent);
} else {
$this->renderPartial('form_queue', array('parent' => $parent, 'queue' => $queue, 'errors' => null));
}
}