コード例 #1
0
 public static function getHTML_Metadata(EAL_LearnOut $lo)
 {
     // Level-Table
     $res = sprintf("<div>%s</div><br/>", CPT_Object::getLevelHTML("lo" . $lo->id, $lo->level, null, "disabled", 0, ''));
     // Taxonomy Terms: Name of Taxonomy and list of terms (if available)
     $res .= sprintf("<div><b>%s</b>:", RoleTaxonomy::getDomains()[$lo->domain]);
     $terms = wp_get_post_terms($lo->id, $lo->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;
 }
コード例 #2
0
ファイル: class.CPT_Item.php プロジェクト: andreas-thor/eal
    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;
    }
コード例 #3
0
 public static function getCurrentRoleDomain()
 {
     $result = array("name" => "", "label" => "");
     $current_role = get_user_meta(get_current_user_id(), 'current_role', true);
     if (!isset($current_role) || $current_role == "") {
         return $result;
     }
     if ($current_role == "administrator") {
         return $result;
     }
     $result["name"] = substr($current_role, 2);
     $result["label"] = RoleTaxonomy::getDomains()[$result["name"]];
     return $result;
 }