Skip to content

Instantly share code, notes, and snippets.

@jordantomax
Created August 1, 2011 16:06
Show Gist options
  • Save jordantomax/1118426 to your computer and use it in GitHub Desktop.
Save jordantomax/1118426 to your computer and use it in GitHub Desktop.
<?
if (!$brief->is_old) {
$xml = simplexml_load_string('<div>' . str_replace('&nbsp;',' ', $rev->desc) . '</div>');
$html = "<h2>" . $rev->title . "</h2>";
if (!empty($brief->deadline)) {
$html = $html . "<h3 style='float: right'>" . 'Deadline: ' . $brief->deadline . "</h3><br/><br/>";
}
foreach ($xml->div as $div){
$arr = $div->attributes();
if (!empty($arr['class']) && $arr['class'] == 'content-section-uneditable') {
$uneditable = $div->asXML();
} else if($arr['class'] == 'content-section' && ($div->div[1] != '')) {
$title = $div->div[0] ;
$val = $div->div[1]->asXML();
$html = $html . '<div class="content-section">';
$html = $html . '<h2>'. str_replace('&nbsp;',' ', $title) .':</h2> <br/>';
$html = $html . str_replace('&nbsp;',' ',$val);
$html = $html . '</div><br/><br/>';
}
foreach ($xml->div as $div){
$arr = $div->attributes();
if (!empty($arr['class']) && $arr['class'] == 'content-section-uneditable') {
$uneditable = $div->asXML();
} else if($arr['class'] == 'content-section' && ($div->div[1] != '')) {
$title = $div->div[0] ;
$val = $div->div[1]->asXML();
$html = $html . '<div class="content-section">';
$html = $html . '<h2>'. str_replace('&nbsp;',' ', $title) .':</h2> <br/>';
$html = $html . str_replace('&nbsp;',' ',$val);
$html = $html . '</div><br/><br/>';
}
}
if (!empty($uneditable)){
$html = '<div class="uneditable" style="width: 30%; float: left;">' . htmlspecialchars_decode($uneditable) . '</div>'. '<div class="editable" style="width: 68%; float: right">' . $html . "</div>";
}
echo $html;
} else {
echo $rev->desc;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment