Exemplo n.º 1
0
 /**
  * Set row class
  *
  * @param   array  &$data  row data to set class for
  *
  * @return  null
  */
 public function setRowClass(&$data)
 {
     $rowclass = $this->getParams()->get('use_as_row_class');
     if ($rowclass == 1) {
         $col = $this->getFullName(false, true, false);
         $rawcol = $col . '_raw';
         foreach ($data as $groupk => $group) {
             for ($i = 0; $i < count($group); $i++) {
                 $c = false;
                 if (isset($data[$groupk][$i]->data->{$rawcol})) {
                     $c = $data[$groupk][$i]->data->{$rawcol};
                 } elseif (isset($data[$groupk][$i]->data->{$col})) {
                     $c = $data[$groupk][$i]->data->{$col};
                 }
                 if ($c !== false) {
                     $c = preg_replace('/[^A-Z|a-z|0-9]/', '-', $c);
                     $c = FabrikString::ltrim($c, '-');
                     $c = FabrikString::rtrim($c, '-');
                     // $$$ rob 24/02/2011 can't have numeric class names so prefix with element name
                     if (is_numeric($c)) {
                         $c = $this->getElement()->name . $c;
                     }
                     $data[$groupk][$i]->class .= ' ' . $c;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Delete the file
  *
  * @param   string $filename Path to file (not including JPATH)
  *
  * @return  void
  */
 protected function deleteFile($filename)
 {
     if (empty($filename)) {
         return;
     }
     $storage = $this->getStorage();
     $file = $storage->clean(JPATH_SITE . '/' . $filename);
     $thumb = $storage->clean(JPATH_SITE . '/' . $storage->_getThumb($filename));
     $cropped = $storage->clean(JPATH_SITE . '/' . $storage->_getCropped($filename));
     $logMsg = 'Delete files: ' . $file . ' , ' . $thumb . ', ' . $cropped . '; user = '******'id');
     JLog::add($logMsg, JLog::WARNING, 'com_fabrik.element.fileupload');
     if ($storage->exists($file)) {
         $storage->delete($file);
     }
     if ($storage->exists($thumb)) {
         $storage->delete($thumb);
     } else {
         if ($storage->exists(JPATH_SITE . '/' . FabrikString::ltrim($thumb, '/'))) {
             $storage->delete(JPATH_SITE . '/' . FabrikString::ltrim($thumb, '/'));
         }
     }
     if ($storage->exists($cropped)) {
         $storage->delete($cropped);
     } else {
         if ($storage->exists(JPATH_SITE . '/' . FabrikString::ltrim($cropped, '/'))) {
             $storage->delete(JPATH_SITE . '/' . FabrikString::ltrim($cropped, '/'));
         }
     }
 }