나는, 각 탭이 방법의 구성 요소 전화 "탭"을 사용하여 만든 모듈을했습니다 :얻고 실행하기 위해 ID를 반환 "편집"동작
include_component('logotipo', 'index');
지금이 구성 요소에 대한 코드입니다 :
<?php if ($sdriving_logotipo->count() > 0): ?>
<div class="span3">
<span class="gris">Vista previa</span>
<?php echo image_tag('/uploads/' . $sdriving_logotipo[0]->getArchivo()); ?>
</div>
<?php else: ?>
<div class="alert alert-block">
<h4><?php echo __('Información!') ?></h4>
<?php echo __('No se ha subido ningún logotipo aún. Haga clic en el botón "Subir nuevo" para crear uno.') ?>
</div>
<?php endif; ?>
이 코드는 잘 작동하지만 내가 좀 더 필요합니다
class logotipoComponents extends sfComponents {
public function executeIndex(sfWebRequest $request) {
$id_empresa = $this->getUser()->getGuardUser()->getSfGuardUserProfile()->getIdempresa();
$this->sdriving_logotipo = Doctrine_Core::getTable('SdrivingLogotipo')->createQuery('a')->leftJoin('a.SdrivingEmpresa e')->where('e.idempresa = ?', $id_empresa)->execute();
}
}
는 그리고 이것은 템플릿 _index.php
입니다. 여기서해야 할 일은 logotipo를 업데이트하여 새 파일을 업로드하고 파일 시스템과 데이터베이스에서 기존 파일을 삭제하거나 기존 레코드를 편집하고 값을 업데이트하는 것입니다. 제가 DB에서 파일 이름을 가져온 다음 파일 시스템에서 파일을 삭제, 새 파일을 업로드하고 내가 쿼리를 구축 할 필요가 다음 첫 번째 옵션을 선택하면
SdrivingEmpresa:
columns:
idempresa:
type: integer(4)
unsigned: true
primary: true
autoincrement: true
idlogotipo:
type: integer(4)
unsigned: true
primary: true
nombre_empresa:
type: string(250)
notnull: true
ruta_emp:
type: string(45)
notnull: true
autoincrement: false
relations:
SdrivingLogotipo:
local: idlogotipo
foreign: idlogotipo
type: one
SdrivingEmisor:
local: idempresa
foreign: idempresa
type: many
SdrivingMaquina:
local: idempresa
foreign: idempresa
type: many
SdrivingOperador:
local: idempresa
foreign: idempresa
type: many
SdrivingTurno:
local: idempresa
foreign: idempresa
type: many
SfGuardUserProfile:
local: idempresa
foreign: idempresa
type: many
SdrivingLogotipo:
columns:
idlogotipo:
type: integer(4)
unsigned: true
primary: true
autoincrement: true
archivo:
type: string(250)
relations:
SdrivingEmpresa:
local: idlogotipo
foreign: idlogotipo
type: many
이 촬영 : 이제이 schema.yml
살펴 소요 SdrivingEmpresa
테이블을 업로드 된 파일의 새 ID로 업데이트하십시오. 이 경우 ID를 얻는 방법과 해당 작업에 대한 논리를 작성하는 위치를 알 수 없습니다. protected function processForm(sfWebRequest $request, sfForm $form) { }
? 'doSave ($ con = null) {}'(SdrivingLogotipoForm.class.php
)에 있습니까? 어디에?
어떤 도움이 필요합니까?