There are some Javascript equivalents available of the functions you seem to require: http://docs.elgg.org/wiki/Javascript/BuiltInFeatures.
The #1368308580 is a unix timestamp informing you when this fatal error has occured. At this time an entry is added to your server's log (Apache log file or php log file if this is a separate file). This entry will contain more information about the fatal error. You can search in your server log for this number (1368308580) to find the entry or you can convert the unix timestamp into a normal time+date format (e.g. here: http://www.gaijin.at/olsutc.php) to know when this error occured and jump to the entries in the server log added around this time.
If you have found the entries in your server log, you might already got an idea how to solve your problem. Otherwise, you can post here the additional info made in the entries here to ask for help as the fatal error message alone won't give any indication alone what might go wrong. The only general advice that comes to my mind: in case you made any changes on your site recently (e.g. added a plugin, made any upgrade) this might be causing the problem and you might need to revert back / disable the plugin etc.
post that code here and we can then spend some time to study it to see what more code is needed to do what you're seeking.
OK, here is the code. It is a API function
/**
* Ratings and Votings into elgg
* ids is a string like that:
* VideoID:Rating:Count_of_Votes;VideoID2 ...
*
* @param string $ids
* @return string
*/
function apiSetRating($ids){
if(!empty($ids)){
$ignore = elgg_set_ignore_access(true);
$ids=explode(';',$ids);
$meldung='';
$error='';
while (list($er)=each($ids)) {
$idRat=explode(':',$ids[$er]);
//get video
$video=get_entity(intval($idRat[0]));
if(!is_object($video)){
$error .='Video '.$idRat[0].' not found
';
}else{
$meldung.='
Video: '.intval($idRat[0]).'
Rating: '.intval($idRat[1]).'
Voting: '.intval($idRat[2]);
//set Rating
$video->agvideoRating=intval($idRat[1]);
//count votings
$video->agvideoVotings=intval($idRat[2]);
}
}
elgg_set_ignore_access($ignore);
return array('succsess'=>'Ratings and Votigs ok','error'=>$error,'Meldung'=>$meldung);
}
return array('error'=>'no IDs');
}
i don't see any explicit ->save() !?;-)
try :-
elgg_unregister_event_handler('all', 'all', 'system_log_listener');
elgg_unregister_event_handler('log', 'systemlog', 'system_log_default_logger');
call.. apiSetRating($ids);
elgg_register_event_handler('all', 'all', 'system_log_listener');
elgg_register_event_handler('log', 'systemlog', 'system_log_default_logger');
-- but need to set it back after your call. - function code is core - not avail to you! how ?
Seems this does not work with setPriority(). However, the following 2 documented methods of ElggMenuItem are doing the same:
setWeight ($priority)
Set the priority of the menu item.
setPriority ($priority)
Set the priority of the menu item
So what on earth is the difference? :-)
Have you tried with setWeight()? this might work.
The priority is part of the EllgMenuItem, but it is not sorted by it.
Now I have done it this way.
I have copied the view "views/default/navigation/menu/default.php" to my plugin under
"myplugin/views/default/navigation/menu/owner_block.php"
Then I added this function to the code to sort the menuitems by priority
function sortOwnerMenu($a, $b)
{
if(is_object($a) AND is_object($b)){
if ($a->getPriority() == $b->getPriority()) {
return 0;
}
return ($a->getPriority() < $b->getPriority()) ? -1 : 1;
}
}
usort($vars['menu']['default'], 'sortOwnerMenu');
This works - but perhaps there is a more "elgg-like" way to do this?
The sort is done during the ElggMenuBuilder::getMenu call: http://reference.elgg.org/1.8/classElggMenuBuilder.html#abfa107901d7c497c1da216e7d14cd4fd
I don't know offhand if there's a way to set this dynamically, but if so, that would be the most elgg-like way I guess.
Ok -so I have done it this way, to get a orderd video-playlist of entities for every user:
//generate a name for metadata unique for every user
$ordernumbername='playlist'.$playlistowner->getGUID();
//use this metadata to order the entities
$videoentity->$ordernumbername; //put the ordernumber to one entity
//Get the entities ordered by the generated name
$params = array(
'type' => 'object',
'subtypes'=>'video',
'full_view' => false,
'order_by_metadata'=>array(
'name' => $ordernumbername,
'direction' => 'ASC',
'as'=>'integer')
);
$videos= elgg_get_entities_from_metadata($params);
No relationships needed!
elgg_unregister_menu_item('topbar', 'dashboard'); is the same function you need to unregister the dashboard link. Where are you adding this? Also try to place the plugin under the bottom of the list.
I have place this in the init function of my plugin.
Now I have run the upgrade.php and the dashboard icon has gone away.
Create an incrementing annotation on the entity for each view and then fetch entities based on these annotations.
Ok, no standards there.
What about somthing like that:
$count=intval($entity->viewcount);
$entity->viewcount = (1 + $count);
or would an annotation be better?
Never have done something with annotation till now.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.