Ejemplo n.º 1
0
/**
* Show content for a specific feature
*/
function dt_return_feature()
{
    global $mc, $feature, $item;
    if ($feature <= 0) {
        return '';
    }
    $ft = new DTFeature($feature);
    if ($ft->isNew()) {
        return;
    }
    $tpl = RMTemplate::get();
    include $tpl->get_template('dtrans_feature.php', 'module', 'dtransport');
}
 /**
  * @desc Obtiene las pantallas del elemento
  * @param bool True devuelve objetos {@link DTFeature}
  * @return array
  */
 function features($asobj = false)
 {
     if (empty($this->_features) || $asobj && !is_a($this->_features[0], 'DTFeature')) {
         $this->_features = array();
         $sql = "SELECT * FROM " . $this->db->prefix("dtrans_features") . " WHERE id_soft='" . $this->id() . "' ORDER BY modified DESC";
         $result = $this->db->query($sql);
         while ($row = $this->db->fetchArray($result)) {
             if ($asobj) {
                 $tmp = new DTFeature();
                 $tmp->assignVars($row);
             } else {
                 $tmp = $row['id_feat'];
             }
             $this->_features[] = $tmp;
         }
     }
     return $this->_features;
 }
Ejemplo n.º 3
0
/**
* @desc Cambia a nueva una característica
**/
function newFeatures()
{
    $ids = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
    $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0;
    //Verificamos si se proporcionó una caracteristica
    if (!is_array($ids) || empty($ids)) {
        redirectMsg('./features.php?item=' . $item, _AS_DT_ERRFEAT, 1);
        die;
    }
    $errors = '';
    foreach ($ids as $k) {
        //Verificamos si la característica es válida
        if ($k <= 0) {
            $errors .= sprintf(_AS_DT_ERRFEATVAL, $k);
            continue;
        }
        //Verificamos si la caracteristica existe
        $ft = new DTFeature($k);
        if ($ft->isNew()) {
            $errors .= sprintf(_AS_DT_ERRFEATEX, $k);
            continue;
        }
        $ft->setShowNew(!$ft->showNew());
        $ft->setModified(time());
        if (!$ft->save()) {
            $errors .= sprintf(_AS_DT_ERRFEATSAVE, $k);
        }
    }
    if ($errors != '') {
        redirectMsg('./features.php?item=' . $item, _AS_DT_ERRORS . $errors, 1);
        die;
    } else {
        redirectMsg('./features.php?item=' . $item, _AS_DT_DBOK, 0);
        die;
    }
}