Skip to content

Instantly share code, notes, and snippets.

@pedroresende
pedroresende / error
Created November 20, 2012 15:39
Stack Trace Error
$contentService = $this->repo->getContentService();
$location = $this->api->getLocationByPath( '/Date-and-Time-Test-Object' );
$content = $this->api->getContentToUpdate( $location->contentInfo );
try {
$newData = new DateTime( '31-09-2012 12:00 am' ); // 31-09-2012 12:00 am
$content->setField( 'date_time', $newData );
$this->api->saveContentUpdate( $content->contentInfo );
} catch (exception $e) {
echo "Exception trying to add and invalid Latitude and Longitude\n";
$content = $this->api->newContent( 'a_gmap_location_class' );
$content->setField( 'name', 'GMap Location Test Object' );
$values = array( 'address' => 'Oslo Norway', 'latitude' => '0.0' , 'longitude' => '0.0' );
$content->setField( 'gmap_location', $value );
$this->api->saveContent( $content );
@pedroresende
pedroresende / gist:8419795
Created January 14, 2014 15:09
REST Client
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="http://getbootstrap.com/docs-assets/ico/favicon.png">
server {
listen 80;
server_name ezp5 admin.ezp5;
index index.php;
root /var/www/html/ezpublish5/web;
autoindex on;
access_log /var/log/nginx/ezp5.log;
error_log /var/log/nginx/ezp5_error.log notice;
@pedroresende
pedroresende / Ezp23447Command.php
Last active August 29, 2015 14:07
Ezp23447Command.php
<?php
namespace Cleverti\EZP23447Bundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@pedroresende
pedroresende / ViewController.php
Created June 12, 2015 10:03
Controller "ez_content:viewLocation" for URI "/" is not callable.
<?php
namespace Cleverti\OverrideViewControllerBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use eZ\Bundle\EzPublishCoreBundle\Controller;
/**
* Description of ViewController
*
var Content = React.createClass({
render: function() {
var view = "/projects/view/" + this.props.content.id;
var edit = "/projects/edit/" + this.props.content.id;
var remove = "/projects/delete/" + this.props.content.id;
return (
<tr role="row" className="even">
<td className="sorting_1"><a href={ edit }>{ this.props.content.id }</a></td>
<td>{this.props.content.client}</td>
<td>{this.props.content.name}</td>
// these are labels for the days of the week
var cal_days_labels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
// these are human-readable month name labels, in order
var cal_months_labels = ['January', 'February', 'March', 'April',
'May', 'June', 'July', 'August', 'September',
'October', 'November', 'December'];
// these are the days of the week for each month, in order
var cal_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var ProjectList = React.createClass({
render: function() {
return (
<option value={this.props.data.projectId}>
{this.props.data.projectName}
</option>
);
}
});
public function setUserVariables($I)
{
if ($I->amIAdmin($I)) {
$URL = '/admin_herbals';
$saveButton_id = '#btupdate';
} else {
$URL = '/herbals';
$saveButton_id = '#submit';
}
}