Exemplo n.º 1
0
	public function executeAddItems(sfWebRequest $request){

		$artefactoId = $request->getParameter('artefactoId');
		if($artefactoId) {
			$index = sfContext::getInstance()->getUser()->getAttribute('N1added'.$artefactoId);
			$configuration = sfProjectConfiguration::getActive();
			$configuration->loadHelpers(array('jQuery','Asset','Tag','Url'));


			$fichero = new Ficheros();

			$fichero->setArtefactoId($artefactoId);

			sfContext::getInstance()->getUser()->setAttribute('inclusion', true);
			$form = new ArtefactoForm();
			$form -> embedForm('item_pos'.++$index, new FicherosForm($fichero));

			$widgetSchema = $form->getWidgetSchema();
			$label = "Fichero $index: ".jq_link_to_remote(image_tag('/sf/sf_admin/images/add'), array(
    			'url'     =>  'artefacto/addItems?artefactoId='.$artefactoId,
    			'update'  =>  'ficheros',
    			'position'=>  'bottom',
			));
			$widgetSchema->setLabel('item_pos'.$index,$label);

			sfContext::getInstance()->getUser()->setAttribute('N1added'.$artefactoId, $index);

			return $this->renderPartial('artefacto/fichero',array
			('index' => $index,'form'=>$form));
		}
	}