/**
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'data':
             $data = $element->_normalizeDataForElementsTable();
             return $element->data;
             break;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string $attribute
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'startDate':
         case 'endDate':
             $date = $element->{$attribute};
             if ($date) {
                 return $date->localeDate();
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * Get Tablet Attribute HTML
  *
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'submission':
             $data = $element->viewEntryLinkOnElementsTable();
             return $element->submission;
             break;
         case 'files':
             $files = $element->normalizeFilesForElementsTable();
             return $element->files;
             break;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     $value = $element->{$attribute};
     if ($value instanceof MultiOptionsFieldData) {
         $options = $value->getOptions();
         $summary = array();
         for ($j = 0; $j < count($options); ++$j) {
             $option = $options[$j];
             if ($option->selected) {
                 $summary[] = $option->label;
             }
         }
         return implode($summary, ', ');
     } else {
         return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'publisher':
         case 'editor':
             if ($element->{$attribute}) {
                 return "<a href='" . $element->{$attribute}->cpEditUrl . "'>" . $element->{$attribute} . "</a>";
             }
         case 'dateApproved':
         case 'dateRejected':
             if (!$element->{$attribute}) {
                 return "-";
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     if ($attribute == 'action') {
         return '<a class="delete icon" role="button" title="Delete"></a>';
     } else {
         $value = $element->{$attribute};
         if ($value instanceof MultiOptionsFieldData) {
             $options = $value->getOptions();
             $summary = array();
             for ($j = 0; $j < count($options); ++$j) {
                 $option = $options[$j];
                 if ($option->selected) {
                     $summary[] = $option->label;
                 }
             }
             return implode($summary, ', ');
         } else {
             return parent::getTableAttributeHtml($element, $attribute);
         }
     }
 }
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'user':
             $user = craft()->users->getUserById($element->userId);
             if ($user == null) {
                 return $element->name;
             } else {
                 $url = UrlHelper::getCpUrl('users/' . $user->id);
                 return "<a href='" . $url . "'>" . $user->getFriendlyName() . "</a>";
             }
         case 'element':
             $element = craft()->elements->getElementById($element->elementId);
             if ($element == null) {
                 return Craft::t('[Deleted element]');
             } else {
                 return "<a href='" . $element->cpEditUrl . "'>" . $element->title . "</a>";
             }
         case 'status':
             return '<span class="status ' . $element->status . '"></span>';
         case 'comment':
             $user = craft()->users->getUserById($element->userId);
             if ($user == null) {
                 $userName = $element->name;
             } else {
                 $url = UrlHelper::getCpUrl('users/' . $user->id);
                 $userName = $user->getFriendlyName();
             }
             $html = '<div class="comment-block">';
             $html .= '<a href="' . $element->getCpEditUrl() . '">';
             $html .= '<span class="username">' . $userName . '</span>';
             $html .= '<small>' . $element->getExcerpt(0, 150) . '</small></a>';
             $html .= '</div>';
             return $html;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     // First give plugins a chance to set this
     $pluginAttributeHtml = craft()->plugins->callFirst('getAssetTableAttributeHtml', array($element, $attribute), true);
     if ($pluginAttributeHtml !== null) {
         return $pluginAttributeHtml;
     }
     switch ($attribute) {
         case 'filename':
             return HtmlHelper::encodeParams('<span style="word-break: break-word;">{fileName}</span>', array('fileName' => $element->filename));
         case 'size':
             if ($element->size) {
                 return craft()->formatter->formatSize($element->size);
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'handle':
             return '<code>' . $element->handle . '</code>';
             break;
         case 'numberOfFields':
             $totalFields = craft()->db->createCommand()->select('COUNT(*)')->from('fieldlayoutfields')->where('layoutId=:layoutId', array(':layoutId' => $element->fieldLayoutId))->queryScalar();
             return $totalFields;
             break;
         case 'totalSubmissions':
             $totalSubmissions = craft()->db->createCommand()->select('COUNT(*)')->from('amforms_submissions')->where('formId=:formId', array(':formId' => $element->id))->queryScalar();
             return $totalSubmissions;
             break;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return mixed|null|string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     // First give plugins a chance to set this
     $pluginAttributeHtml = craft()->plugins->callFirst('getEntryTableAttributeHtml', array($element, $attribute), true);
     if ($pluginAttributeHtml !== null) {
         return $pluginAttributeHtml;
     }
     switch ($attribute) {
         case 'author':
             $author = $element->getAuthor();
             if ($author) {
                 return craft()->templates->render('_elements/element', array('element' => $author));
             } else {
                 return '';
             }
         case 'section':
             $section = $element->getSection();
             return $section ? Craft::t($section->name) : '';
         case 'type':
             $entryType = $element->getType();
             return $entryType ? Craft::t($entryType->name) : '';
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
Esempio n. 12
0
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'filename':
             return '<span style="word-break: break-word;">' . $element->filename . '</span>';
         case 'size':
             if ($element->size) {
                 return craft()->formatter->formatSize($element->size);
             } else {
                 return '';
             }
         case 'dateModified':
             $date = $element->{$attribute};
             if ($date) {
                 return $date->localeDate();
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     // First give plugins a chance to set this
     $pluginAttributeHtml = craft()->plugins->callFirst('getUserTableAttributeHtml', array($element, $attribute), true);
     if ($pluginAttributeHtml !== null) {
         return $pluginAttributeHtml;
     }
     switch ($attribute) {
         case 'email':
             $email = $element->email;
             if ($email) {
                 return HtmlHelper::encodeParams('<a href="mailto:{email}">{email}</a>', array('email' => $email));
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
Esempio n. 14
0
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'sectionId':
             return Craft::t($element->getSection()->name);
         case 'postDate':
         case 'expiryDate':
             $date = $element->{$attribute};
             if ($date) {
                 return $date->localeDate();
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
Esempio n. 15
0
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     // First give plugins a chance to set this
     $pluginAttributeHtml = craft()->plugins->callFirst('getAssetTableAttributeHtml', array($element, $attribute), true);
     if ($pluginAttributeHtml !== null) {
         return $pluginAttributeHtml;
     }
     switch ($attribute) {
         case 'filename':
             return HtmlHelper::encodeParams('<span style="word-break: break-word;">{fileName}</span>', array('fileName' => $element->filename));
         case 'kind':
             return IOHelper::getFileKindLabel($element->kind);
         case 'size':
             if ($element->size) {
                 return craft()->formatter->formatSize($element->size);
             } else {
                 return '';
             }
         case 'imageSize':
             if (($width = $element->getWidth()) && ($height = $element->getHeight())) {
                 return "{$width} × {$height}";
             } else {
                 return '';
             }
         case 'width':
         case 'height':
             $size = $element->{$attribute};
             return $size ? $size . 'px' : '';
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     // First give plugins a chance to set this
     $pluginAttributeHtml = craft()->plugins->callFirst('getCategoryTableAttributeHtml', array($element, $attribute), true);
     if ($pluginAttributeHtml !== null) {
         return $pluginAttributeHtml;
     }
     return parent::getTableAttributeHtml($element, $attribute);
 }
Esempio n. 17
0
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'email':
             $email = $element->email;
             if ($email) {
                 return '<a href="mailto:' . $email . '">' . $email . '</a>';
             } else {
                 return '';
             }
         case 'lastLoginDate':
             $date = $element->{$attribute};
             if ($date) {
                 return $date->localeDate();
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string $attribute
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'email':
             $email = $element->email;
             if ($email) {
                 return '<a href="mailto:' . $email . '">' . $email . '</a>';
             } else {
                 return '';
             }
             // @TODO fix this to sort by date created since the date field is not actually an element attribute.
         // @TODO fix this to sort by date created since the date field is not actually an element attribute.
         case 'dateCreated':
             $date = $element->{$attribute};
             if ($date) {
                 return $date->localeDate();
             } else {
                 return '';
             }
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'platform':
             switch ($element->{$attribute}) {
                 case PushNotifications_AppModel::PLATFORM_IOS:
                     return Craft::t('iOS');
                     break;
                 case PushNotifications_AppModel::PLATFORM_ANDROID:
                     return Craft::t('Android');
                     break;
             }
             break;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'body':
             return strlen($element->{$attribute}) > 50 ? substr($element->{$attribute}, 0, 50) . '...' : $element->{$attribute};
             break;
         case 'command':
             $app = $element->getApp();
             foreach ($app->commands as $command) {
                 if ($command['param'] == $element->{$attribute}) {
                     return $command['name'];
                 }
             }
             break;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'notes':
             $notes = craft()->db->createCommand()->select('COUNT(*)')->from('amforms_notes')->where('submissionId=:submissionId', array(':submissionId' => $element->id))->queryScalar();
             return sprintf('<a href="%s">%d</a>', $element->getCpEditUrl() . '/notes', $notes);
             break;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 /**
  * Returns the table view HTML for a given attribute.
  *
  * @param BaseElementModel $element
  * @param string $attribute
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'title':
             return $element->{$attribute};
         case 'metaPath':
             return $element->{$attribute};
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }
 /**
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     switch ($attribute) {
         case 'method':
             $method = $element->{$attribute};
             //Get method options
             $methods = array_flip(SproutSeo_RedirectMethods::getConstants());
             return $method . ' - ' . $methods[$method];
         case 'test':
             // Send link for testing
             $link = "<a href='{$element->oldUrl}' target='_blank' class='go'>Test</a>";
             if ($element->regex) {
                 $link = " - ";
             }
             return $link;
         default:
             return parent::getTableAttributeHtml($element, $attribute);
             break;
     }
 }
 /**
  * @inheritDoc IElementType::getTableAttributeHtml()
  *
  * @param BaseElementModel $element
  * @param string           $attribute
  *
  * @return mixed|null|string
  */
 public function getTableAttributeHtml(BaseElementModel $element, $attribute)
 {
     // First give plugins a chance to set this
     $pluginAttributeHtml = craft()->plugins->callFirst('getEntryTableAttributeHtml', array($element, $attribute), true);
     if ($pluginAttributeHtml !== null) {
         return $pluginAttributeHtml;
     }
     switch ($attribute) {
         case 'section':
             return Craft::t($element->getSection()->name);
         default:
             return parent::getTableAttributeHtml($element, $attribute);
     }
 }