Ejemplo n.º 1
0
 function getSelect($id, $event, $function, array $option, $name)
 {
     $this->event = $event;
     $this->select = parent::getComponent($id, $event, $function, $name) . " ><option id=0  >--Seleccionar--</option>";
     foreach ($option as $key => $value) {
         $this->select .= "<option>" . $value . "</option>";
     }
     return $this->select . "</select>";
 }
 /**
  * 
  * @param Component $component
  * @return int id of the Component inserted in base. False if it didn't work.
  */
 public static function flush($component)
 {
     $componentId = $component->getId();
     $mark = $component->getMark();
     $date = $component->getDate();
     $isResit = $component->getIsResit();
     $user = $component->getUser()->getId();
     $componentLinked = $component->getComponent()->getId();
     $module = $component->getModule()->getId();
     $type = $component->getType()->getId();
     if ($componentId > 0) {
         $sql = 'UPDATE component c SET ' . 'c.mark = ?, ' . 'c.date = ?, ' . 'c.is_resit = ?, ' . 'c.USER_id_user = ?, ' . 'c.COMPONENT_id_component = ?, ' . 'c.MODULE_id_module = ?, ' . 'c.TYPE_id_type= ? ' . 'WHERE c.id_component = ?';
         $params = array('dsiiiiii', &$mark, &$date, &$isResit, &$user, &$componentLinked, &$module, &$type, &$componentId);
     } else {
         $sql = 'INSERT INTO component ' . '(mark, date, is_resit, ' . 'USER_id_user, COMPONENT_id_component, MODULE_id_module, TYPE_id_type ) ' . 'VALUES(?, ?, ?, ?, ?, ?, ?) ';
         $params = array('dsiiiii', &$mark, &$date, &$isResit, &$user, &$componentLinked, &$module, &$type);
     }
     $idInsert = BaseSingleton::insertOrEdit($sql, $params);
     if ($idInsert !== false && $componentId > 0) {
         $idInsert = $componentId;
     }
     return $idInsert;
 }