Esempio n. 1
0
    public static function getHTML_Metadata(EAL_Item $item, $editable, $namePrefix)
    {
        // Status and Id
        $res = sprintf("<div>%s (%d)</div><br/>", $item->getStatusString(), $item->id);
        // Learning Outcome (Title + Description), if available
        $learnout = $item->getLearnOut();
        if ($editable) {
            $res .= sprintf("<div>%s</div>", EAL_LearnOut::getListOfLearningOutcomes($learnout == null ? 0 : $learnout->id, $namePrefix));
        } else {
            if (!is_null($learnout)) {
                $res .= sprintf("<div><b>%s</b>: %s</div><br/>", $learnout->title, $learnout->description);
            }
        }
        // Level-Table
        $res .= sprintf("<div>%s</div><br/>", CPT_Object::getLevelHTML($namePrefix, $item->level, is_null($learnout) ? null : $learnout->level, $editable ? "" : "disabled", 1, ''));
        // Taxonomy Terms: Name of Taxonomy and list of terms (if available)
        $res .= sprintf("<div><b>%s</b>:", RoleTaxonomy::getDomains()[$item->domain]);
        if ($editable) {
            $res .= sprintf('
				<div class="inside">
					<div class="categorydiv">
						<div id="topic-all" class="tabs-panel"><input type="hidden" name="%1$s_taxonomy[]" value="0">
							<ul id="topicchecklist" data-wp-lists="list:topic" class="categorychecklist form-no-clear">
							%2$s
							</ul>
						</div>
					</div>
				</div>', $namePrefix, CPT_Item::getHTML_TopicHierarchy($namePrefix, get_terms(array('taxonomy' => $item->domain, 'hide_empty' => false)), 0, wp_get_post_terms($item->id, $item->domain, array("fields" => "ids"))));
        } else {
            $terms = wp_get_post_terms($item->id, $item->domain, array("fields" => "names"));
            if (count($terms) > 0) {
                $res .= sprintf("<div style='margin-left:1em'>");
                foreach ($terms as $t) {
                    $res .= sprintf("%s</br>", $t);
                }
                $res .= sprintf("</div>");
            }
        }
        $res .= sprintf("</div>");
        return $res;
    }
Esempio n. 2
0
 public static function delete($post_id)
 {
     parent::delete($post_id);
     global $wpdb;
     $wpdb->delete('{$wpdb->prefix}eal_itemmc', array('item_id' => $post_id), array('%d'));
 }