Exemple #1
0
 public function form(&$node, &$form_state)
 {
     $type = $this->getNodeTypeInfo();
     $wt = -15;
     $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title, '#weight' => $wt++);
     $form['author_name'] = array('#type' => 'textfield', '#title' => t('Author name'), '#default_value' => isset($node->author_name) ? $node->author_name : '', '#size' => 32, '#maxlength' => 32, '#weight' => $wt++);
     $form['media_source'] = array('#type' => 'textfield', '#title' => t('Media Source'), '#default_value' => isset($node->media_source) ? $node->media_source : '', '#description' => t('Online publisher name.'), '#autocomplete_path' => 'newsarticle/autocomplete/media_source', '#size' => 64, '#maxlength' => 128, '#weight' => $wt++);
     $form['url'] = array('#type' => 'textfield', '#title' => t('URL'), '#default_value' => isset($node->url) ? $node->url : '', '#description' => t('Article URL.'), '#size' => 80, '#maxlength' => 512, '#weight' => $wt++);
     $form['datestr'] = array('#type' => 'textfield', '#title' => t('Publication date'), '#default_value' => isset($node->datestr) ? $node->datestr : scf_date_string(time()), '#maxlength' => 18, '#description' => t('Format: %date', array('%date' => scf_date_string(time()))), '#weight' => $wt++);
     $this->addNodeBodyField($form, $node, $wt++);
     return $form;
 }
Exemple #2
0
 private function listMemberContributions($uid)
 {
     $sql = "SELECT DISTINCT n.nid FROM {node} n";
     $sql .= " INNER JOIN {pubnode} p ON p.vid = n.vid";
     $sql .= " INNER JOIN {pubnode_contributors} pc ON pc.vid = p.vid";
     $sql .= " INNER JOIN {contributor} c ON pc.cid = c.nid";
     $sql .= " INNER JOIN {users} u ON c.cuid = u.uid";
     $sql .= " WHERE n.status = 1";
     $sql .= " AND u.uid = %d";
     $sql .= " ORDER BY p.pubdate ASC";
     $result = db_query($sql, $uid);
     $out = array();
     while ($nid = db_result($result)) {
         $node = node_load($nid);
         $item = l($node->title, 'node/' . $node->nid, !empty($node->comment_count) ? array('title' => format_plural($node->comment_count, '1 comment', '@count comments')) : array());
         if (isset($node->pubdate) && $node->pubdate) {
             $item .= " (" . scf_date_string($node->pubdate) . ")";
         }
         $out[] = $item;
     }
     return $out;
 }