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

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


			$fichero = new Ficheros();

			$fichero->setversionId($versionId);

			sfContext::getInstance()->getUser()->setAttribute('inclusion', true);
			$form = new VersionForm();
			$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'     =>  'version/addItems?versionId='.$versionId,
    			'update'  =>  'ficheros',
    			'position'=>  'bottom',
			));
			$widgetSchema->setLabel('item_pos'.$index,$label);

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

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