Ok....so....can you tell me what method is calling by button "Cooliris" in Phoca Gallery - Categorie (back-end)?
And in what file is this method?
I try to create a new file that call the same method after the Upload in front-end.
I send you this file if it's works
Thanks
EDIT 1: the button Cooliris call this JS function:
Code: Select all
javascript:if(document.adminForm.boxchecked.value==0){alert('Seleziona un elemento dalla lista');}else{ hideMainMenu(); submitbutton('PicLens')}
Now i try to search "submitbutton->PicLens"
EDIT 2: i've found in administrator\components\com_phocagallery\controllers\phocagalleryc.php the result of generation:
Code: Select all
function piclens() {
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$model = $this->getModel( 'phocagalleryc' );
if(!$model->piclens($cids))
{
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
$msg = JText::_( 'Error Creating PicLens RSS File(s)' );
}
else {
$msg = JText::_( 'PicLens RSS File(s) created' );
}
$link = 'index.php?option=com_phocagallery&view=phocagallerycs';
$this->setRedirect( $link, $msg );
}
and in administrator\components\com_phocagallery\models\phocagalleryc.php....i think....the generator:
Code: Select all
function piclens($cids) {
$db =& JFactory::getDBO();
$path = PhocaGalleryPath::getPath();
$piclensImg = $path->image_rel_front.'icon-phocagallery.png';
$paramsC= JComponentHelper::getParams('com_phocagallery') ;
jimport('joomla.filesystem.file');
// PARAMS
// original 0, thumbnail 1
$piclens_image = $paramsC->get( 'piclens_image', 1);
if (JFolder::exists($path->image_abs)) {
foreach ($cids as $kcid =>$vcid) {
$this->setXMLFile();
if (!$this->_XMLFile) {
$this->setError( 'Could not create XML builder' );
return false;
}
if (!$node = $this->_XMLFile->createElement( 'rss' )) {
$this->setError( 'Could not create node!' );
return false;
}
$node->setAttribute( 'xmlns:media', 'http://search.yahoo.com/mrss' );
$node->setAttribute( 'xmlns:atom', 'http://www.w3.org/2005/Atom' );
$node->setAttribute( 'version', '2.0' );
$this->_XMLFile->setDocumentElement( $node );
if (!$root =& $this->_XMLFile->documentElement) {
$this->setError( 'Could not obtain root element!' );
return false;
}
$channel =& $this->_XMLFile->createElement( 'channel' );
$atomIcon=& $this->_XMLFile->createElement( 'atom:icon' );
$atomIcon->setText( JURI::root() . $piclensImg );
$channel->appendChild( $atomIcon );
$query = 'SELECT a.id, a.title, a.filename, a.description, a.extid, a.extl, a.exto'
. ' FROM #__phocagallery AS a'
. ' WHERE a.catid = '.(int)$vcid
. ' AND a.published = 1'
. ' ORDER BY a.catid, a.ordering';
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $krow => $vrow) {
$file = PhocaGalleryFileThumbnail::getOrCreateThumbnail($vrow->filename, '');
$thumbFile = str_replace( "administrator", "", $file['thumb_name_l_no_rel']);
$origFile = str_replace( "administrator", "", $file['name_original_rel']);
$item=& $this->_XMLFile->createElement( 'item' );
$item->appendChild( $this->_buildXMLElement( 'title', $vrow->title ) );
if ($vrow->extid != '') {
$item->appendChild( $this->_buildXMLElement( 'link', $vrow->extl ));
} else {
$item->appendChild( $this->_buildXMLElement( 'link', JURI::root().$thumbFile ) );
}
//$item->appendChild( $this->_buildXMLElement( 'media:description', $vrow->description ) );
$item->appendChild( $this->_buildXMLElement( 'description', JFilterOutput::cleanText(strip_tags($vrow->description ))));
$thumbnail=& $this->_XMLFile->createElement( 'media:thumbnail' );
if ($vrow->extid != '') {
$thumbnail->setAttribute( 'url', $vrow->extl );
$content=& $this->_XMLFile->createElement( 'media:content' );
if ($piclens_image == 1) {
$content->setAttribute( 'url', $vrow->extl );
} else {
$content->setAttribute( 'url', $vrow->exto );
}
} else {
$thumbnail->setAttribute( 'url', JURI::root().$thumbFile );
$content=& $this->_XMLFile->createElement( 'media:content' );
if ($piclens_image == 1) {
$content->setAttribute( 'url', JURI::root().$thumbFile );
} else {
$content->setAttribute( 'url', JURI::root().$origFile );
}
}
$item->appendChild( $thumbnail );
$item->appendChild( $content );
$guid=& $this->_XMLFile->createElement( 'guid' );
if ($vrow->extid != '') {
$guid->setText( $vcid .'-phocagallerypiclenscode-'.$vrow->extid );
} else {
$guid->setText( $vcid .'-phocagallerypiclenscode-'.$vrow->filename );
}
$guid->setAttribute( 'isPermaLink', "false" );
$item->appendChild( $guid );
$channel->appendChild( $this->_buildXMLElement( 'title', 'Phoca Gallery' ));
$channel->appendChild( $this->_buildXMLElement( 'link', 'https://www.phoca.cz/' ));
$channel->appendChild( $this->_buildXMLElement( 'description', 'Phoca Gallery' ));
$channel->appendChild( $item );
}
$root->appendChild( $channel );
$this->_XMLFile->setXMLDeclaration( '<?xml version="1.0" encoding="utf-8" standalone="yes"?>' );
//echo $this->_XMLFile->toNormalizedString( true );exit;
// saveXML_utf8 doesn't save setXMLDeclaration
/*if (!$this->_XMLFile->saveXML( $path->image_abs . DS . $vcid.'.rss', true )) {
$this->setError( 'Could not save XML file!' );
return false;
}*/
ob_start();
echo $this->_XMLFile->toNormalizedString(false, true);
$xmlToWrite = ob_get_contents();
ob_end_clean();
if(!JFile::write( $path->image_abs . DS . $vcid.'.rss', $xmlToWrite)) {
$this->setError( 'Could not save XML file!' );
return false;
}
}
return true;
} else {
$this->setError( 'Phoca Gallery image folder not exists' );
}
}
EDIT 3: in front-end, the upload of new image call function OnUploadSubmitPG(). I want to attach function piclens() in OnUploadSubmitPG() but i don't find where's this function. Can you help me Jan?
BeLakor